@8wave/ai-elements 0.125.0-beta.10 → 0.125.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkChatbotFilePreview-DuvRnOes.js → PkChatbotFilePreview-fbgRmR9n.js} +58 -55
- package/dist/_chunks/PkChatbotFilePreview-fbgRmR9n.js.map +1 -0
- package/dist/_chunks/{PkStreamingMarkdown-BM-DSTPr.js → PkStreamingMarkdown-CfdkyZqP.js} +803 -799
- package/dist/_chunks/PkStreamingMarkdown-CfdkyZqP.js.map +1 -0
- package/dist/_chunks/{PkToolChatFile-DbeOmRPh.js → PkToolChatFile-ClZrtYIz.js} +2 -2
- package/dist/_chunks/{PkToolChatFile-DbeOmRPh.js.map → PkToolChatFile-ClZrtYIz.js.map} +1 -1
- package/dist/_chunks/{PkToolShareDocument-Buzu27rQ.js → PkToolShareDocument-DLRwzPaL.js} +2 -2
- package/dist/_chunks/{PkToolShareDocument-Buzu27rQ.js.map → PkToolShareDocument-DLRwzPaL.js.map} +1 -1
- package/dist/_chunks/{PkToolShowArtifact-utxGuLLt.js → PkToolShowArtifact-Dc4YM786.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-utxGuLLt.js.map → PkToolShowArtifact-Dc4YM786.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DTtE93D3.js → PkToolShowContactForm-CU1Sv3DA.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DTtE93D3.js.map → PkToolShowContactForm-CU1Sv3DA.js.map} +1 -1
- package/dist/_chunks/{PkToolShowDiagram-BHd-C_cx.js → PkToolShowDiagram-BDrdT_AB.js} +4 -2
- package/dist/_chunks/PkToolShowDiagram-BDrdT_AB.js.map +1 -0
- package/dist/_chunks/{PkToolShowForm-I4pKopEI.js → PkToolShowForm-DDgEmFRc.js} +2 -2
- package/dist/_chunks/{PkToolShowForm-I4pKopEI.js.map → PkToolShowForm-DDgEmFRc.js.map} +1 -1
- package/dist/_chunks/{PkToolShowImageGallery-skV87BlD.js → PkToolShowImageGallery-BCSO1iSG.js} +9 -4
- package/dist/_chunks/PkToolShowImageGallery-BCSO1iSG.js.map +1 -0
- package/dist/_chunks/{PkToolShowSources-DLmVS3bL.js → PkToolShowSources-DDI2s76O.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-DLmVS3bL.js.map → PkToolShowSources-DDI2s76O.js.map} +1 -1
- package/dist/_chunks/{useLightbox-BigL4WLe.js → useLightbox-BEEzZ0qT.js} +112 -41
- package/dist/_chunks/useLightbox-BEEzZ0qT.js.map +1 -0
- package/dist/ai-elements.es.js +2420 -2409
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotEmptyState.js +1 -1
- package/dist-vue/PkChatbotFilePreview.js +1 -1
- package/dist-vue/PkChatbotInput.js +1 -1
- package/dist-vue/PkChatbotMessages.js +1 -1
- package/dist-vue/PkChatbotSteps.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-CLOfTLQy.js → PkChatbot-D4SNWH_2.js} +3 -3
- package/dist-vue/_chunks/{PkChatbot-CLOfTLQy.js.map → PkChatbot-D4SNWH_2.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-C9aUiynZ.js → PkChatbotEmptyState-BnCCmm10.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-C9aUiynZ.js.map → PkChatbotEmptyState-BnCCmm10.js.map} +1 -1
- package/dist-vue/_chunks/PkChatbotFilePreview-BpVM850N.js +291 -0
- package/dist-vue/_chunks/PkChatbotFilePreview-BpVM850N.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotInput-Bs8nn-Jz.js → PkChatbotInput-COjn57UP.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotInput-Bs8nn-Jz.js.map → PkChatbotInput-COjn57UP.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-BxkCGmqV.js → PkChatbotMessages-D-m0cOqM.js} +282 -279
- package/dist-vue/_chunks/PkChatbotMessages-D-m0cOqM.js.map +1 -0
- package/dist-vue/_chunks/{PkChatbotSteps-MTSA_RrY.js → PkChatbotSteps-BWKjM1Z4.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotSteps-MTSA_RrY.js.map → PkChatbotSteps-BWKjM1Z4.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-BwXOt2WW.js → PkChatbotViewChat-DIh2wVa_.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotViewChat-BwXOt2WW.js.map → PkChatbotViewChat-DIh2wVa_.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-DlcTV5je.js → PkStreamingMarkdown-BZPAHAni.js} +760 -757
- package/dist-vue/_chunks/PkStreamingMarkdown-BZPAHAni.js.map +1 -0
- package/dist-vue/_chunks/{PkSvgViewer-DBYr0CUi.js → PkSvgViewer-DmkElalq.js} +4 -2
- package/dist-vue/_chunks/PkSvgViewer-DmkElalq.js.map +1 -0
- package/dist-vue/_chunks/{PkToolChatFile-HWGjtuaT.js → PkToolChatFile-BGH2cQuM.js} +2 -2
- package/dist-vue/_chunks/{PkToolChatFile-HWGjtuaT.js.map → PkToolChatFile-BGH2cQuM.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShareDocument-CsS5OTDj.js → PkToolShareDocument-BIZkgcJ3.js} +2 -2
- package/dist-vue/_chunks/{PkToolShareDocument-CsS5OTDj.js.map → PkToolShareDocument-BIZkgcJ3.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowArtifact-C8OIF_sy.js → PkToolShowArtifact-DCe8yizN.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-C8OIF_sy.js.map → PkToolShowArtifact-DCe8yizN.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-K6Z5MUXk.js → PkToolShowContactForm-4bO4fM5O.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-K6Z5MUXk.js.map → PkToolShowContactForm-4bO4fM5O.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-DrlGh_v6.js → PkToolShowDiagram-DNRUCCt8.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-DrlGh_v6.js.map → PkToolShowDiagram-DNRUCCt8.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-DzsXJfOl.js → PkToolShowForm-CQwXQwgt.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowForm-DzsXJfOl.js.map → PkToolShowForm-CQwXQwgt.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-sCyrPOIT.js → PkToolShowImageGallery-CgDng1Gr.js} +17 -12
- package/dist-vue/_chunks/PkToolShowImageGallery-CgDng1Gr.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowLocation-DAQEuCuQ.js → PkToolShowLocation-DCPaDtBI.js} +3 -3
- package/dist-vue/_chunks/PkToolShowLocation-DCPaDtBI.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowProductList-DPDDeVu4.js → PkToolShowProductList-DyPyz1pU.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-DPDDeVu4.js.map → PkToolShowProductList-DyPyz1pU.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-D4zjssdh.js → PkToolShowSources-C3JjevRj.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-D4zjssdh.js.map → PkToolShowSources-C3JjevRj.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-C77DAqoZ.js → PkToolShowVideo--qiiAK7R.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-C77DAqoZ.js.map → PkToolShowVideo--qiiAK7R.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-D_tqGI6o.js → PkToolShowWebPages-Cw9FPQuL.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-D_tqGI6o.js.map → PkToolShowWebPages-Cw9FPQuL.js.map} +1 -1
- package/dist-vue/_chunks/useLightbox-gSzoBgNv.js +190 -0
- package/dist-vue/_chunks/useLightbox-gSzoBgNv.js.map +1 -0
- package/dist-vue/composables.js +8 -0
- package/dist-vue/composables.js.map +1 -1
- package/dist-vue/index.js +2899 -2898
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/locales.js +10 -0
- package/dist-vue/packages/components/src/composables/useLightbox.d.ts +33 -3
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkChatbotFilePreview-DuvRnOes.js.map +0 -1
- package/dist/_chunks/PkStreamingMarkdown-BM-DSTPr.js.map +0 -1
- package/dist/_chunks/PkToolShowDiagram-BHd-C_cx.js.map +0 -1
- package/dist/_chunks/PkToolShowImageGallery-skV87BlD.js.map +0 -1
- package/dist/_chunks/useLightbox-BigL4WLe.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotFilePreview-KxVpL0UT.js +0 -391
- package/dist-vue/_chunks/PkChatbotFilePreview-KxVpL0UT.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotMessages-BxkCGmqV.js.map +0 -1
- package/dist-vue/_chunks/PkStreamingMarkdown-DlcTV5je.js.map +0 -1
- package/dist-vue/_chunks/PkSvgViewer-DBYr0CUi.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowImageGallery-sCyrPOIT.js.map +0 -1
- package/dist-vue/_chunks/PkToolShowLocation-DAQEuCuQ.js.map +0 -1
- package/dist-vue/_chunks/cdn-css-C3_zuSx6.js +0 -15
- package/dist-vue/_chunks/cdn-css-C3_zuSx6.js.map +0 -1
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
import { Et as e, L as t, Ot as n, S as r, Tt as i, _ as a, d as o, f as s, g as c, gt as l, h as u, k as d, kt as f, l as p, nt as m, ot as h, r as g, v as _, w as v,
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import {
|
|
1
|
+
import { Et as e, L as t, Ot as n, S as r, Tt as i, _ as a, d as o, f as s, g as c, gt as l, h as u, k as d, kt as f, l as p, nt as m, ot as h, r as g, v as _, w as v, wt as y, x as b, y as x, z as S } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
|
|
2
|
+
import { t as C } from "./index.es-C7ON2BA3.js";
|
|
3
|
+
import { t as w } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
|
|
4
|
+
import { r as T } from "./useLightbox-BEEzZ0qT.js";
|
|
5
5
|
// ../../packages/components/src/chat/PkChatbotFilePreview.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
d(),
|
|
7
|
-
var
|
|
6
|
+
d(), h(), g(), i();
|
|
7
|
+
var E = [
|
|
8
8
|
"href",
|
|
9
9
|
"data-pswp-src",
|
|
10
10
|
"data-pswp-width",
|
|
11
11
|
"data-pswp-height",
|
|
12
12
|
"data-pswp-caption",
|
|
13
|
+
"data-pswp-shared",
|
|
13
14
|
"aria-label"
|
|
14
|
-
],
|
|
15
|
+
], D = ["src", "alt"], O = {
|
|
15
16
|
key: 0,
|
|
16
17
|
class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay"
|
|
17
|
-
},
|
|
18
|
+
}, ee = {
|
|
18
19
|
key: 1,
|
|
19
20
|
class: "pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error"
|
|
20
|
-
},
|
|
21
|
+
}, te = {
|
|
21
22
|
key: 0,
|
|
22
23
|
class: "pk-chatbot-file-preview__caption"
|
|
23
|
-
},
|
|
24
|
+
}, k = ["title"], A = { class: "pk-chatbot-file-preview__meta" }, j = ["title"], M = ["title", "aria-label"], N = { class: "pk-chatbot-file-preview__body" }, P = ["title"], F = { class: "pk-chatbot-file-preview__meta" }, I = ["title"], L = ["title", "aria-label"], R = ["title", "aria-label"], z = [
|
|
24
25
|
"href",
|
|
25
26
|
"title",
|
|
26
27
|
"aria-label"
|
|
27
|
-
],
|
|
28
|
+
], B = ["title", "aria-label"], V = 300, H = /*#__PURE__*/ w(/* @__PURE__ */ v({
|
|
28
29
|
__name: "PkChatbotFilePreview",
|
|
29
30
|
props: {
|
|
30
31
|
mediaType: { type: String },
|
|
@@ -48,7 +49,7 @@ var T = [
|
|
|
48
49
|
}, g = u(() => !d.asFile && d.mediaType.startsWith("image/")), v = u(() => {
|
|
49
50
|
let e = d.filename ?? "", t = e.lastIndexOf(".");
|
|
50
51
|
return t > 0 ? e.slice(t + 1).toLowerCase() : "";
|
|
51
|
-
}),
|
|
52
|
+
}), w = u(() => d.mediaType.split("/")[1]?.split(";")[0] ?? ""), H = [
|
|
52
53
|
{
|
|
53
54
|
test: /pdf/,
|
|
54
55
|
kind: {
|
|
@@ -129,15 +130,15 @@ var T = [
|
|
|
129
130
|
label: "Text"
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
|
-
],
|
|
133
|
+
], U = u(() => {
|
|
133
134
|
let e = `${d.mediaType} ${v.value}`;
|
|
134
|
-
for (let { test: t, kind: n } of
|
|
135
|
+
for (let { test: t, kind: n } of H) if (t.test(e)) return n;
|
|
135
136
|
return {
|
|
136
137
|
icon: "ri:file-line",
|
|
137
138
|
accent: "#64748b",
|
|
138
139
|
label: "File"
|
|
139
140
|
};
|
|
140
|
-
}),
|
|
141
|
+
}), W = u(() => (v.value || w.value || U.value.label).toUpperCase()), G = u(() => {
|
|
141
142
|
let e = d.size;
|
|
142
143
|
if (e === void 0 || e < 0) return;
|
|
143
144
|
if (e < 1024) return `${e} B`;
|
|
@@ -149,31 +150,32 @@ var T = [
|
|
|
149
150
|
], n = e / 1024, r = 0;
|
|
150
151
|
for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
|
|
151
152
|
return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${t[r]}`;
|
|
152
|
-
}),
|
|
153
|
-
|
|
154
|
-
},
|
|
153
|
+
}), K = /* @__PURE__ */ new Map(), q = (e, t) => {
|
|
154
|
+
K.delete(e), K.set(e, t), K.size > V && K.delete(K.keys().next().value);
|
|
155
|
+
}, J = K.get(d.url), Y = l(J?.status ?? "loading"), X = l(J?.dimensions), Z = (e) => {
|
|
155
156
|
let t = e.target;
|
|
156
|
-
t.naturalWidth && t.naturalHeight && (
|
|
157
|
+
t.naturalWidth && t.naturalHeight && (X.value = {
|
|
157
158
|
width: t.naturalWidth,
|
|
158
159
|
height: t.naturalHeight
|
|
159
|
-
}),
|
|
160
|
+
}), Y.value = "loaded", q(d.url, {
|
|
160
161
|
status: "loaded",
|
|
161
|
-
dimensions:
|
|
162
|
+
dimensions: X.value
|
|
162
163
|
});
|
|
163
|
-
},
|
|
164
|
-
|
|
165
|
-
}, Q = u(() =>
|
|
164
|
+
}, ne = () => {
|
|
165
|
+
Y.value = "error", q(d.url, { status: "error" });
|
|
166
|
+
}, Q = u(() => X.value ?? ae), re = u(() => [X.value && `${X.value.width}×${X.value.height}`, G.value].filter(Boolean)), ie = u(() => [W.value, G.value].filter(Boolean)), ae = {
|
|
166
167
|
width: 1200,
|
|
167
168
|
height: 800
|
|
168
|
-
}, $ = l(), { init:
|
|
169
|
+
}, $ = l(), { init: oe, shared: se } = T({
|
|
169
170
|
gallery: $,
|
|
170
|
-
loop: !1
|
|
171
|
+
loop: !1,
|
|
172
|
+
shared: !0
|
|
171
173
|
});
|
|
172
174
|
return t(async () => {
|
|
173
|
-
g.value && await
|
|
175
|
+
g.value && await oe();
|
|
174
176
|
}), (t, l) => {
|
|
175
|
-
let u =
|
|
176
|
-
return g.value ? (
|
|
177
|
+
let u = C;
|
|
178
|
+
return g.value ? (S(), x("figure", {
|
|
177
179
|
key: 0,
|
|
178
180
|
class: e(["pk-chatbot-file-preview pk-chatbot-file-preview--image", { "pk-chatbot-file-preview--compact": i.compact }])
|
|
179
181
|
}, [
|
|
@@ -187,6 +189,7 @@ var T = [
|
|
|
187
189
|
"data-pswp-width": Q.value.width,
|
|
188
190
|
"data-pswp-height": Q.value.height,
|
|
189
191
|
"data-pswp-caption": i.filename ?? "",
|
|
192
|
+
"data-pswp-shared": y(se) || void 0,
|
|
190
193
|
class: "pk-chatbot-file-preview__thumb-link",
|
|
191
194
|
"aria-label": i.filename ?? t.$t("label.file")
|
|
192
195
|
}, [m(c("img", {
|
|
@@ -194,27 +197,27 @@ var T = [
|
|
|
194
197
|
alt: i.filename,
|
|
195
198
|
decoding: "async",
|
|
196
199
|
class: "pk-chatbot-file-preview__thumb",
|
|
197
|
-
onLoad:
|
|
198
|
-
onError:
|
|
199
|
-
}, null, 40,
|
|
200
|
-
i.compact ? _("", !0) : (
|
|
200
|
+
onLoad: Z,
|
|
201
|
+
onError: ne
|
|
202
|
+
}, null, 40, D), [[p, Y.value === "loaded"]])], 8, E), i.loading || Y.value === "loading" ? (S(), x("span", O, [r(u, { name: "loading-loop" })])) : Y.value === "error" ? (S(), x("span", ee, [r(u, { name: "ri:image-2-line" })])) : _("", !0)], 512),
|
|
203
|
+
i.compact ? _("", !0) : (S(), x("figcaption", te, [i.filename ? (S(), x("span", {
|
|
201
204
|
key: 0,
|
|
202
205
|
class: "pk-chatbot-file-preview__name",
|
|
203
206
|
title: i.filename
|
|
204
|
-
}, f(i.filename), 9,
|
|
207
|
+
}, f(i.filename), 9, k)) : _("", !0), c("span", A, [i.error ? (S(), x("span", {
|
|
205
208
|
key: 0,
|
|
206
209
|
class: "pk-chatbot-file-preview__error",
|
|
207
210
|
title: i.error
|
|
208
|
-
}, [r(u, { name: "ri:error-warning-line" }),
|
|
209
|
-
i.removable && !i.loading ? (
|
|
211
|
+
}, [r(u, { name: "ri:error-warning-line" }), b(" " + f(i.error), 1)], 8, j)) : (S(), x(s, { key: 1 }, [b(f(re.value.join(" · ")), 1)], 64))])])),
|
|
212
|
+
i.removable && !i.loading ? (S(), x("button", {
|
|
210
213
|
key: 1,
|
|
211
214
|
type: "button",
|
|
212
215
|
class: "pk-chatbot-file-preview__remove",
|
|
213
216
|
title: t.$t("action.remove"),
|
|
214
217
|
"aria-label": t.$t("action.remove"),
|
|
215
218
|
onClick: l[0] ||= o((e) => t.$emit("remove"), ["prevent"])
|
|
216
|
-
}, [r(u, { name: "ri:close-line" })], 8,
|
|
217
|
-
], 2)) : (
|
|
219
|
+
}, [r(u, { name: "ri:close-line" })], 8, M)) : _("", !0)
|
|
220
|
+
], 2)) : (S(), x("div", {
|
|
218
221
|
key: 1,
|
|
219
222
|
class: e(["pk-chatbot-file-preview pk-chatbot-file-preview--doc", {
|
|
220
223
|
"pk-chatbot-file-preview--error": i.error,
|
|
@@ -224,45 +227,45 @@ var T = [
|
|
|
224
227
|
}, [
|
|
225
228
|
c("span", {
|
|
226
229
|
class: "pk-chatbot-file-preview__icon-tile",
|
|
227
|
-
style: n({ "--file-accent":
|
|
228
|
-
}, [i.loading ? (
|
|
230
|
+
style: n({ "--file-accent": U.value.accent })
|
|
231
|
+
}, [i.loading ? (S(), a(u, {
|
|
229
232
|
key: 0,
|
|
230
233
|
name: "loading-loop",
|
|
231
234
|
class: "pk-chatbot-file-preview__icon"
|
|
232
|
-
})) : (
|
|
235
|
+
})) : (S(), a(u, {
|
|
233
236
|
key: 1,
|
|
234
|
-
name:
|
|
237
|
+
name: U.value.icon,
|
|
235
238
|
class: "pk-chatbot-file-preview__icon"
|
|
236
239
|
}, null, 8, ["name"]))], 4),
|
|
237
|
-
c("span",
|
|
240
|
+
c("span", N, [i.filename ? (S(), x("span", {
|
|
238
241
|
key: 0,
|
|
239
242
|
class: "pk-chatbot-file-preview__name",
|
|
240
243
|
title: i.filename
|
|
241
|
-
}, f(i.filename), 9,
|
|
244
|
+
}, f(i.filename), 9, P)) : _("", !0), c("span", F, [i.error ? (S(), x("span", {
|
|
242
245
|
key: 0,
|
|
243
246
|
class: "pk-chatbot-file-preview__error",
|
|
244
247
|
title: i.error
|
|
245
|
-
}, [r(u, { name: "ri:error-warning-line" }),
|
|
246
|
-
!i.loading && !i.error && !i.compact ? (
|
|
248
|
+
}, [r(u, { name: "ri:error-warning-line" }), b(" " + f(i.error), 1)], 8, I)) : (S(), x(s, { key: 1 }, [b(f(ie.value.join(" · ")), 1)], 64))])]),
|
|
249
|
+
!i.loading && !i.error && !i.compact ? (S(), x("span", {
|
|
247
250
|
key: 0,
|
|
248
251
|
class: e(["pk-chatbot-file-preview__actions", { "pk-chatbot-file-preview__actions--bar": i.onPreview || i.onRestore }])
|
|
249
252
|
}, [
|
|
250
|
-
i.onRestore ? (
|
|
253
|
+
i.onRestore ? (S(), x("button", {
|
|
251
254
|
key: 0,
|
|
252
255
|
type: "button",
|
|
253
256
|
class: "pk-chatbot-file-preview__open u-touch-target",
|
|
254
257
|
title: t.$t("chatFilePreview.restore"),
|
|
255
258
|
"aria-label": `${t.$t("chatFilePreview.restore")}${i.filename ? ` — ${i.filename}` : ""}`,
|
|
256
259
|
onClick: l[1] ||= (...e) => i.onRestore && i.onRestore(...e)
|
|
257
|
-
}, [r(u, { name: "ri:arrow-go-back-line" })], 8,
|
|
258
|
-
i.onPreview ? (
|
|
260
|
+
}, [r(u, { name: "ri:arrow-go-back-line" })], 8, L)) : _("", !0),
|
|
261
|
+
i.onPreview ? (S(), x("button", {
|
|
259
262
|
key: 1,
|
|
260
263
|
type: "button",
|
|
261
264
|
class: "pk-chatbot-file-preview__open u-touch-target",
|
|
262
265
|
title: t.$t("chatFilePreview.open"),
|
|
263
266
|
"aria-label": `${t.$t("chatFilePreview.open")}${i.filename ? ` — ${i.filename}` : ""}`,
|
|
264
267
|
onClick: l[2] ||= (...e) => i.onPreview && i.onPreview(...e)
|
|
265
|
-
}, [r(u, { name: "ri:eye-line" })], 8,
|
|
268
|
+
}, [r(u, { name: "ri:eye-line" })], 8, R)) : _("", !0),
|
|
266
269
|
c("a", {
|
|
267
270
|
href: i.url,
|
|
268
271
|
target: "_blank",
|
|
@@ -271,20 +274,20 @@ var T = [
|
|
|
271
274
|
title: t.$t("action.download"),
|
|
272
275
|
"aria-label": `${t.$t("action.download")}${i.filename ? ` — ${i.filename}` : ""}`,
|
|
273
276
|
onClick: h
|
|
274
|
-
}, [r(u, { name: "ri:download-2-line" })], 8,
|
|
277
|
+
}, [r(u, { name: "ri:download-2-line" })], 8, z)
|
|
275
278
|
], 2)) : _("", !0),
|
|
276
|
-
i.removable && !i.loading ? (
|
|
279
|
+
i.removable && !i.loading ? (S(), x("button", {
|
|
277
280
|
key: 1,
|
|
278
281
|
type: "button",
|
|
279
282
|
class: e(["pk-chatbot-file-preview__remove", { "pk-chatbot-file-preview__remove--inline": !i.compact }]),
|
|
280
283
|
title: t.$t("action.remove"),
|
|
281
284
|
"aria-label": t.$t("action.remove"),
|
|
282
285
|
onClick: l[3] ||= (e) => t.$emit("remove")
|
|
283
|
-
}, [r(u, { name: "ri:close-line" })], 10,
|
|
286
|
+
}, [r(u, { name: "ri:close-line" })], 10, B)) : _("", !0)
|
|
284
287
|
], 2));
|
|
285
288
|
};
|
|
286
289
|
}
|
|
287
290
|
}), [["styles", [".pk-chatbot-file-preview{--file-radius:var(--rounded-lg,12px);background-color:var(--color-surface-1);border:1px solid var(--color-surface-3);border-radius:var(--file-radius);max-width:280px;color:var(--color-word-2);font-size:var(--text-12);position:relative}.pk-chatbot-file-preview--error{border-color:var(--color-danger)}.pk-chatbot-file-preview--doc{align-items:center;gap:var(--spacing-8);padding:var(--spacing-8);min-width:0;transition:border-color .18s var(--ease-out), background-color .18s var(--ease-out), box-shadow .18s var(--ease-out);display:flex}.pk-chatbot-file-preview--doc:hover{border-color:var(--color-surface-4);background-color:var(--color-surface-2);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview__icon-tile{width:var(--spacing-36);height:var(--spacing-36);border-radius:var(--rounded-md,6px);background-color:color-mix(in srgb, var(--file-accent) 14%, transparent);color:var(--file-accent);flex-shrink:0;justify-content:center;align-items:center;display:flex}.pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview__body{flex-direction:column;flex:1;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__actions{flex-shrink:0;align-items:center;margin-inline-start:var(--spacing-4);display:flex}.pk-chatbot-file-preview__actions--bar{padding:var(--spacing-2);border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded);margin-inline-start:var(--spacing-8)}.pk-chatbot-file-preview__open{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded);color:var(--color-word-3);cursor:pointer;opacity:0;transition:opacity .18s var(--ease-out), color .18s var(--ease-out), background-color .18s var(--ease-out);background:0 0;border:0;flex-shrink:0;justify-content:center;align-items:center;padding:0;text-decoration:none;display:flex;position:relative}.pk-chatbot-file-preview__open:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview__open .vv-icon{width:var(--spacing-16);height:var(--spacing-16)}.pk-chatbot-file-preview__actions--bar .pk-chatbot-file-preview__open{width:var(--spacing-24);height:var(--spacing-24)}.pk-chatbot-file-preview--doc:hover .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--doc:focus-within .pk-chatbot-file-preview__open,.pk-chatbot-file-preview--show-download .pk-chatbot-file-preview__open{opacity:1}@media (hover:none){.pk-chatbot-file-preview--doc .pk-chatbot-file-preview__open{opacity:1}}.pk-chatbot-file-preview--image{flex-direction:column;margin:0;display:inline-flex}.pk-chatbot-file-preview__thumb-wrap{background-color:var(--color-surface);border-radius:var(--file-radius);width:280px;max-width:100%;height:200px;display:flex;position:relative;overflow:hidden}.pk-chatbot-file-preview__thumb-link{cursor:pointer;width:100%;height:100%;display:flex}.pk-chatbot-file-preview__thumb{object-fit:cover;width:100%;height:100%;display:block}.pk-chatbot-file-preview__caption{padding:var(--spacing-8);flex-direction:column;gap:1px;min-width:0;display:flex}.pk-chatbot-file-preview__name{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-weight:var(--font-medium,500);color:var(--color-word-1);overflow:hidden}.pk-chatbot-file-preview__meta{text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--text-10);line-height:var(--leading-normal);min-height:1.4em;color:var(--color-word-4);font-variant-numeric:tabular-nums;overflow:hidden}.pk-chatbot-file-preview__error{align-items:center;gap:var(--spacing-4);color:var(--u-danger-text,var(--color-danger));display:inline-flex}.pk-chatbot-file-preview__error .vv-icon{flex-shrink:0}.pk-chatbot-file-preview__status{justify-content:center;align-items:center;display:inline-flex}.pk-chatbot-file-preview__status .vv-icon{width:var(--spacing-32);height:var(--spacing-32)}.pk-chatbot-file-preview__status--overlay{background-color:color-mix(in srgb, var(--color-surface-1) 70%, transparent);color:var(--color-word-1);position:absolute;inset:0}.pk-chatbot-file-preview__status--error{color:var(--color-word-4)}.pk-chatbot-file-preview__remove{width:var(--spacing-28);height:var(--spacing-28);border-radius:var(--rounded-full,9999px);background-color:color-mix(in srgb, var(--color-surface-1) 85%, transparent);color:var(--color-word-2);cursor:pointer;box-shadow:var(--shadow-sm);transition:background-color .18s var(--ease-out), color .18s var(--ease-out), scale .12s var(--ease-out);border:none;justify-content:center;align-items:center;padding:0;line-height:1;display:flex;position:absolute;top:0;right:0;transform:translate(50%,-50%)}.pk-chatbot-file-preview__remove:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}.pk-chatbot-file-preview__remove:active{scale:.96}.pk-chatbot-file-preview__remove--inline{box-shadow:none;color:var(--color-word-4);background-color:#0000;flex-shrink:0;position:static}.pk-chatbot-file-preview__remove--inline:hover{background-color:var(--color-surface-3);color:var(--color-word-1)}.pk-chatbot-file-preview--compact{--chip-size:var(--spacing-56);max-width:240px}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--image{width:var(--chip-size);height:var(--chip-size);border-radius:var(--rounded-md,6px)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-wrap,.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__thumb-link{width:100%;height:100%}.pk-chatbot-file-preview--compact.pk-chatbot-file-preview--doc{height:var(--chip-size);gap:var(--spacing-8);padding:var(--spacing-8);padding-inline-end:var(--spacing-28)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon-tile{--chip-tile-size:calc(var(--chip-size) - 2 * var(--spacing-8) - 2px);width:var(--chip-tile-size);height:var(--chip-tile-size)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__icon{width:var(--spacing-20);height:var(--spacing-20)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove{top:var(--spacing-4);right:var(--spacing-4);width:var(--spacing-24);height:var(--spacing-24);border:1px solid var(--color-surface-4);background-color:var(--color-surface);color:var(--color-word-1);font-size:var(--text-16);box-shadow:var(--shadow-sm)}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:after{content:\"\";inset:calc(-1 * var(--spacing-4));position:absolute}.pk-chatbot-file-preview--compact .pk-chatbot-file-preview__remove:hover{background-color:var(--color-surface-2);color:var(--color-word-1)}@media (prefers-reduced-motion:reduce){.pk-chatbot-file-preview--doc,.pk-chatbot-file-preview__open,.pk-chatbot-file-preview__remove{transition:none}}"]]]);
|
|
288
|
-
export {
|
|
291
|
+
export { H as t };
|
|
289
292
|
|
|
290
|
-
//# sourceMappingURL=PkChatbotFilePreview-
|
|
293
|
+
//# sourceMappingURL=PkChatbotFilePreview-fbgRmR9n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PkChatbotFilePreview-fbgRmR9n.js","names":["$t","$emit","__unplugin_components_0","_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_unref","_withDirectives","_vShow","_createVNode","_createCommentVNode","_toDisplayString","_createTextVNode","_Fragment","_withModifiers","_normalizeStyle","_createBlock","_sfc_main","_style_0","normalizeClass","onMounted","normalizeStyle","createVNode","init_shared_esm_bundler","createBlock","withModifiers","Fragment","createBaseVNode","ref","computed","init_runtime_core_esm_bundler","toDisplayString","vShow","withDirectives","init_reactivity_esm_bundler","init_runtime_dom_esm_bundler","createCommentVNode","defineComponent","unref","createTextVNode","createElementBlock","openBlock","Ce","_plugin_vue_export_helper_default","useLightbox","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","THUMB_CACHE_MAX","PkChatbotFilePreview_default","props","__props","onOpenClick","event","isImage","extension","name","dot","subtype","KINDS","fileKind","haystack","test","kind","typeTag","formattedSize","bytes","units","value","unitIndex","thumbCache","setThumbCache","url","entry","cached","thumbStatus","dimensions","onImageLoad","img","onImageError","pswpSize","DEFAULT_PSWP_SIZE","imageMeta","docMeta","galleryRef","init","_component_VvIcon","shared","_ctx","_cache","args"],"sources":["../../../../packages/components/src/chat/PkChatbotFilePreview.vue","../../../../packages/components/src/chat/PkChatbotFilePreview.vue","../../../../packages/components/src/chat/PkChatbotFilePreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { computed, ref, onMounted } from 'vue'\n import { useLightbox } from '../composables/useLightbox'\n\n const props = defineProps<{\n mediaType: string\n url: string\n filename?: string\n /** Size in bytes, when known (e.g. local uploads). */\n size?: number\n loading?: boolean\n error?: string\n removable?: boolean\n /**\n * Dense layout for the composer: a small square thumbnail / slim row,\n * without the metadata caption. The full card is reserved for the\n * message log where the details matter.\n */\n compact?: boolean\n /**\n * Keeps the download button visible instead of revealing it on hover:\n * for a file the agent wrote, which the user is there to download.\n */\n showDownload?: boolean\n /**\n * Replaces the download link of a document with a call, for a file\n * whose download URL is minted on demand (a knowledge base document\n * shared in the chat). `url` stays the link's `href`.\n */\n onDownload?: () => void | Promise<void>\n /**\n * Draws an image as a file row, with its download button, instead of\n * a thumbnail: for an image whose `url` stops working while its\n * download keeps going (a shared document after its link expires).\n */\n asFile?: boolean\n /**\n * Opens the file in the chat's viewer: a Word document or a\n * spreadsheet the chat stores, with a button beside the download.\n */\n onPreview?: () => void\n /**\n * Asks for this earlier version of the file back as the newest one,\n * with a button before the others.\n */\n onRestore?: () => void\n }>()\n\n defineEmits<{\n remove: []\n }>()\n\n const onOpenClick = (event: MouseEvent) => {\n if (!props.onDownload) {\n return\n }\n event.preventDefault()\n void props.onDownload()\n }\n\n const isImage = computed(\n () => !props.asFile && props.mediaType.startsWith('image/'),\n )\n\n // --- File-type identity (icon + accent + human kind label) ---\n\n const extension = computed(() => {\n const name = props.filename ?? ''\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''\n })\n\n // mediaType subtype, e.g. \"pdf\" from \"application/pdf\"\n const subtype = computed(\n () => props.mediaType.split('/')[1]?.split(';')[0] ?? '',\n )\n\n type FileKind = {\n icon: string\n // CSS color driving the icon glyph + tile tint\n accent: string\n label: string\n }\n\n const KINDS: Array<{ test: RegExp; kind: FileKind }> = [\n {\n test: /pdf/,\n kind: {\n icon: 'ri:file-pdf-2-line',\n accent: '#e2483d',\n label: 'PDF',\n },\n },\n {\n // Match Word specifically: the generic `document` substring also\n // appears in the XLSX/PPTX OOXML mime types (…officedocument…), so\n // matching it here would mis-label spreadsheets/decks as Word.\n test: /msword|wordprocessingml/,\n kind: {\n icon: 'ri:file-word-2-line',\n accent: '#2b7de9',\n label: 'Word',\n },\n },\n {\n test: /sheet|excel|csv/,\n kind: {\n icon: 'ri:file-excel-2-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n },\n },\n {\n test: /presentation|powerpoint/,\n kind: {\n icon: 'ri:file-ppt-2-line',\n accent: '#d98324',\n label: 'Presentation',\n },\n },\n {\n test: /zip|compressed|x-7z|x-rar|x-tar|gzip/,\n kind: {\n icon: 'ri:file-zip-line',\n accent: '#c08a1e',\n label: 'Archive',\n },\n },\n {\n // Reached only by an image drawn as a file (`asFile`).\n test: /^image\\//,\n kind: {\n icon: 'ri:image-2-line',\n accent: '#0ea5e9',\n label: 'Image',\n },\n },\n {\n test: /^audio\\//,\n kind: {\n icon: 'ri:file-music-line',\n accent: '#8b5cf6',\n label: 'Audio',\n },\n },\n {\n test: /^video\\//,\n kind: {\n icon: 'ri:film-line',\n accent: '#6366f1',\n label: 'Video',\n },\n },\n {\n // The code an agent can take (`SUPPORTED_CODE_TYPES`).\n test: /json|javascript|typescript|xml|html|css|yaml|toml|sql|x-(?:sh|python|java|kotlin|c|csharp|go|rust|ruby|php|swift|vue)\\b/,\n kind: {\n icon: 'ri:file-code-line',\n accent: '#0d9488',\n label: 'Code',\n },\n },\n {\n test: /^text\\//,\n kind: {\n icon: 'ri:file-text-line',\n accent: '#64748b',\n label: 'Text',\n },\n },\n ]\n\n const fileKind = computed<FileKind>(() => {\n const haystack = `${props.mediaType} ${extension.value}`\n for (const { test, kind } of KINDS) {\n if (test.test(haystack)) {\n return kind\n }\n }\n return {\n icon: 'ri:file-line',\n accent: '#64748b',\n label: 'File',\n }\n })\n\n // Short type tag shown in the meta line: prefer the real extension, fall\n // back to the mime subtype, then the generic kind label.\n const typeTag = computed(() =>\n (\n extension.value ||\n subtype.value ||\n fileKind.value.label\n ).toUpperCase(),\n )\n\n // --- Size & dimensions ---\n\n const formattedSize = computed(() => {\n const bytes = props.size\n if (bytes === undefined || bytes < 0) {\n return undefined\n }\n if (bytes < 1024) {\n return `${bytes} B`\n }\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let unitIndex = 0\n while (value >= 1024 && unitIndex < units.length - 1) {\n value /= 1024\n unitIndex += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unitIndex]}`\n })\n\n // Thumbnail load lifecycle. Driving the spinner and the error fallback\n // off the real <img> events (not a second background fetch) means the\n // image is requested exactly once and reuses the browser cache on any\n // later re-render, instead of re-downloading every time the message list\n // repaints.\n // Not `useImageFallback`: this tile also needs `loading` vs `loaded` and the\n // decoded dimensions, cached across remounts, so the error flag is one field\n // of a richer per-url entry rather than a standalone broken-url set.\n type ThumbStatus = 'loading' | 'loaded' | 'error'\n\n // Module-level, keyed by URL: survives component recreation. In polled\n // views (e.g. admin chat-logs, refreshed every few seconds) the whole\n // message array is replaced on each poll, so this component can be torn\n // down and rebuilt. Seeding from the cache means a URL that already\n // decoded starts in `loaded` (no spinner flash, no re-decode) instead of\n // flickering back through `loading`. This is a client-side, per-session\n // cache (no server/Redis involved); bounded to a max size so a long-lived\n // session browsing many images can't grow it without limit — the oldest\n // entry is evicted first (Map preserves insertion order).\n type ThumbEntry = {\n status: ThumbStatus\n dimensions?: { width: number; height: number }\n }\n const THUMB_CACHE_MAX = 300\n const thumbCache = new Map<string, ThumbEntry>()\n const setThumbCache = (url: string, entry: ThumbEntry) => {\n // Re-insert to mark as most-recently used, then trim from the front.\n thumbCache.delete(url)\n thumbCache.set(url, entry)\n if (thumbCache.size > THUMB_CACHE_MAX) {\n thumbCache.delete(thumbCache.keys().next().value as string)\n }\n }\n\n const cached = thumbCache.get(props.url)\n const thumbStatus = ref<ThumbStatus>(cached?.status ?? 'loading')\n\n // Natural pixel dimensions, captured once the thumbnail decodes. Doubles\n // as the size hint PhotoSwipe needs for its slide (falls back until known).\n const dimensions = ref<{ width: number; height: number } | undefined>(\n cached?.dimensions,\n )\n const onImageLoad = (event: Event) => {\n const img = event.target as HTMLImageElement\n if (img.naturalWidth && img.naturalHeight) {\n dimensions.value = {\n width: img.naturalWidth,\n height: img.naturalHeight,\n }\n }\n thumbStatus.value = 'loaded'\n setThumbCache(props.url, {\n status: 'loaded',\n dimensions: dimensions.value,\n })\n }\n const onImageError = () => {\n thumbStatus.value = 'error'\n setThumbCache(props.url, { status: 'error' })\n }\n\n const pswpSize = computed(() => dimensions.value ?? DEFAULT_PSWP_SIZE)\n\n // Meta fragments joined with \" · \" for the caption / doc subtitle.\n const imageMeta = computed(() =>\n [\n dimensions.value &&\n `${dimensions.value.width}×${dimensions.value.height}`,\n formattedSize.value,\n ].filter(Boolean),\n )\n const docMeta = computed(() =>\n [typeTag.value, formattedSize.value].filter(Boolean),\n )\n\n // --- Lightbox ---\n\n // Slide size PhotoSwipe assumes before the real dimensions are known.\n const DEFAULT_PSWP_SIZE = { width: 1200, height: 800 }\n\n // In a conversation the image opens in its lightbox, with the others\n const galleryRef = ref<HTMLElement>()\n const { init, shared } = useLightbox({\n gallery: galleryRef,\n loop: false,\n shared: true,\n })\n\n onMounted(async () => {\n if (!isImage.value) {\n return\n }\n await init()\n })\n</script>\n\n<template>\n <!-- Image attachment: a thumbnail tile with a metadata caption -->\n <figure\n v-if=\"isImage\"\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--image\"\n :class=\"{ 'pk-chatbot-file-preview--compact': compact }\">\n <div ref=\"galleryRef\" class=\"pk-chatbot-file-preview__thumb-wrap\">\n <a\n :href=\"url\"\n :data-pswp-src=\"url\"\n :data-pswp-width=\"pswpSize.width\"\n :data-pswp-height=\"pswpSize.height\"\n :data-pswp-caption=\"filename ?? ''\"\n :data-pswp-shared=\"shared || undefined\"\n class=\"pk-chatbot-file-preview__thumb-link\"\n :aria-label=\"filename ?? $t('label.file')\">\n <img\n v-show=\"thumbStatus === 'loaded'\"\n :src=\"url\"\n :alt=\"filename\"\n decoding=\"async\"\n class=\"pk-chatbot-file-preview__thumb\"\n @load=\"onImageLoad\"\n @error=\"onImageError\" />\n </a>\n <!-- Spinner until the thumbnail decodes (or while an upload is in\n flight); a fixed box keeps this from shifting the layout. -->\n <span\n v-if=\"loading || thumbStatus === 'loading'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay\">\n <VvIcon name=\"loading-loop\" />\n </span>\n <!-- Failed to load: a quiet icon instead of the browser's broken\n image glyph. -->\n <span\n v-else-if=\"thumbStatus === 'error'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error\">\n <VvIcon name=\"ri:image-2-line\" />\n </span>\n </div>\n <figcaption v-if=\"!compact\" class=\"pk-chatbot-file-preview__caption\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ imageMeta.join(' · ') }}</template>\n </span>\n </figcaption>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click.prevent=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </figure>\n\n <!-- Document attachment: an icon tile + name + type · size -->\n <div\n v-else\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--doc\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n 'pk-chatbot-file-preview--show-download': showDownload,\n }\">\n <span\n class=\"pk-chatbot-file-preview__icon-tile\"\n :style=\"{ '--file-accent': fileKind.accent }\">\n <VvIcon\n v-if=\"loading\"\n name=\"loading-loop\"\n class=\"pk-chatbot-file-preview__icon\" />\n <VvIcon\n v-else\n :name=\"fileKind.icon\"\n class=\"pk-chatbot-file-preview__icon\" />\n </span>\n <span class=\"pk-chatbot-file-preview__body\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ docMeta.join(' · ') }}</template>\n </span>\n </span>\n <!-- The actions of a file the chat's viewer opens: a small bar of\n their own, apart from the name and the size -->\n <span\n v-if=\"!loading && !error && !compact\"\n class=\"pk-chatbot-file-preview__actions\"\n :class=\"{\n 'pk-chatbot-file-preview__actions--bar': onPreview || onRestore,\n }\">\n <button\n v-if=\"onRestore\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.restore')\"\n :aria-label=\"`${$t('chatFilePreview.restore')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onRestore\">\n <VvIcon name=\"ri:arrow-go-back-line\" />\n </button>\n <button\n v-if=\"onPreview\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.open')\"\n :aria-label=\"`${$t('chatFilePreview.open')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onPreview\">\n <VvIcon name=\"ri:eye-line\" />\n </button>\n <a\n :href=\"url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('action.download')\"\n :aria-label=\"`${$t('action.download')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onOpenClick\">\n <VvIcon name=\"ri:download-2-line\" />\n </a>\n </span>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :class=\"{ 'pk-chatbot-file-preview__remove--inline': !compact }\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-file-preview {\n // Concentric radii: outer card and inner tiles share an 8px step.\n --file-radius: var(--rounded-lg, 12px);\n\n position: relative;\n max-width: 280px;\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--file-radius);\n color: var(--color-word-2);\n font-size: var(--text-12);\n\n &--error {\n border-color: var(--color-danger);\n }\n\n // --- Document card ---\n &--doc {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n min-width: 0;\n transition:\n border-color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out),\n box-shadow 0.18s var(--ease-out);\n\n &:hover {\n border-color: var(--color-surface-4);\n background-color: var(--color-surface-2);\n box-shadow: var(--shadow-sm);\n }\n }\n\n &__icon-tile {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-36);\n height: var(--spacing-36);\n\n // One step down from the card radius keeps the nested tile concentric.\n border-radius: var(--rounded-md, 6px);\n\n // Tint derived from the file-type accent; glyph sits at full accent.\n background-color: color-mix(\n in srgb,\n var(--file-accent) 14%,\n transparent\n );\n color: var(--file-accent);\n }\n\n &__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n\n &__body {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n flex: 1;\n }\n\n &__actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n margin-inline-start: var(--spacing-4);\n }\n\n // Restore, open and download of a file the viewer opens: one small\n // bar, its hairline setting it apart from the name and the size, the\n // icons 8px apart so they read as a group\n &__actions--bar {\n margin-inline-start: var(--spacing-8);\n padding: var(--spacing-2);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n }\n\n // 28px to aim at with a mouse, 24 in the bar; 40px under a finger\n // (u-touch-target)\n &__open {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: 0;\n border-radius: var(--rounded);\n background: none;\n color: var(--color-word-3);\n text-decoration: none;\n cursor: pointer;\n opacity: 0;\n transition:\n opacity 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n\n .vv-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &__actions--bar &__open {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &--doc:hover &__open,\n &--doc:focus-within &__open,\n &--show-download &__open {\n opacity: 1;\n }\n\n // Touch devices have no hover: keep the open affordance visible.\n @media (hover: none) {\n &--doc &__open {\n opacity: 1;\n }\n }\n\n // --- Image card ---\n &--image {\n display: inline-flex;\n flex-direction: column;\n margin: 0;\n }\n\n &__thumb-wrap {\n position: relative;\n display: flex;\n\n // Fixed box: the card claims its final footprint before the\n // image decodes, so the message log never shifts on load.\n width: 280px;\n max-width: 100%;\n height: 200px;\n background-color: var(--color-surface);\n border-radius: var(--file-radius);\n overflow: hidden;\n }\n\n &__thumb-link {\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n }\n\n &__thumb {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__caption {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: var(--spacing-8);\n min-width: 0;\n }\n\n &__name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: var(--font-medium, 500);\n color: var(--color-word-1);\n }\n\n &__meta {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--text-10);\n line-height: var(--leading-normal);\n\n // Reserve the line even while empty: image dimensions arrive\n // only after decode and must not grow the caption.\n min-height: 1.4em;\n color: var(--color-word-4);\n\n // Stable column for the dimensions/size figures.\n font-variant-numeric: tabular-nums;\n }\n\n &__error {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n color: var(--u-danger-text, var(--color-danger));\n\n .vv-icon {\n flex-shrink: 0;\n }\n }\n\n &__status {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n .vv-icon {\n width: var(--spacing-32);\n height: var(--spacing-32);\n }\n\n &--overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 70%,\n transparent\n );\n color: var(--color-word-1);\n }\n\n &--error {\n color: var(--color-word-4);\n }\n }\n\n // --- Remove button (input context) ---\n &__remove {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: flex;\n align-items: center;\n justify-content: center;\n\n // Visible glyph is 18px but the hit area stays a comfortable 28px.\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: none;\n border-radius: var(--rounded-full, 9999px);\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n color: var(--color-word-2);\n cursor: pointer;\n line-height: 1;\n box-shadow: var(--shadow-sm);\n transition:\n background-color 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n scale 0.12s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n\n &:active {\n scale: 0.96;\n }\n\n // Inside the document row the button rides inline, not overlaid\n // (size is inherited from the base).\n &--inline {\n position: static;\n flex-shrink: 0;\n box-shadow: none;\n background-color: transparent;\n color: var(--color-word-4);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n }\n }\n\n // --- Compact (composer) chips ---\n // ChatGPT/Gemini-style: every attachment is the SAME height and carries\n // an always-visible round remove control in the top-right corner — no\n // hover-revealed actions, no size mismatch between image and file chips.\n &--compact {\n // Shared chip height so image and file chips align in the row.\n --chip-size: var(--spacing-56);\n\n max-width: 240px;\n\n &.pk-chatbot-file-preview--image {\n width: var(--chip-size);\n height: var(--chip-size);\n border-radius: var(--rounded-md, 6px);\n }\n\n // Fill the square; the root's `overflow: hidden` rounds the corners.\n .pk-chatbot-file-preview__thumb-wrap,\n .pk-chatbot-file-preview__thumb-link {\n width: 100%;\n height: 100%;\n }\n\n &.pk-chatbot-file-preview--doc {\n height: var(--chip-size);\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n\n // Reserve room so the corner remove button never overlaps the\n // name/meta text.\n padding-inline-end: var(--spacing-28);\n }\n\n // Square icon tile that fills the chip height, so file chips read at\n // the same scale as image thumbnails: the chip less its padding and\n // its two 1px borders. Not `align-self: stretch` with `aspect-ratio`,\n // which Safari sizes from the chip's outer height, so the tile ran\n // past the chip's bottom edge.\n .pk-chatbot-file-preview__icon-tile {\n --chip-tile-size: calc(\n var(--chip-size) - 2 * var(--spacing-8) - 2px\n );\n\n width: var(--chip-tile-size);\n height: var(--chip-tile-size);\n }\n\n .pk-chatbot-file-preview__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n // Always-visible round remove control in the top-right corner. Sits\n // just inside the chip (an ancestor clips overflow), bigger than before,\n // with an extended hit area for easy tapping.\n &--compact &__remove {\n top: var(--spacing-4);\n right: var(--spacing-4);\n width: var(--spacing-24);\n height: var(--spacing-24);\n border: 1px solid var(--color-surface-4);\n background-color: var(--color-surface);\n color: var(--color-word-1);\n font-size: var(--text-16);\n box-shadow: var(--shadow-sm);\n\n // Comfortable touch/click target beyond the small visible glyph.\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-4));\n }\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n &--doc,\n &__open,\n &__remove {\n transition: none;\n }\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import { computed, ref, onMounted } from 'vue'\n import { useLightbox } from '../composables/useLightbox'\n\n const props = defineProps<{\n mediaType: string\n url: string\n filename?: string\n /** Size in bytes, when known (e.g. local uploads). */\n size?: number\n loading?: boolean\n error?: string\n removable?: boolean\n /**\n * Dense layout for the composer: a small square thumbnail / slim row,\n * without the metadata caption. The full card is reserved for the\n * message log where the details matter.\n */\n compact?: boolean\n /**\n * Keeps the download button visible instead of revealing it on hover:\n * for a file the agent wrote, which the user is there to download.\n */\n showDownload?: boolean\n /**\n * Replaces the download link of a document with a call, for a file\n * whose download URL is minted on demand (a knowledge base document\n * shared in the chat). `url` stays the link's `href`.\n */\n onDownload?: () => void | Promise<void>\n /**\n * Draws an image as a file row, with its download button, instead of\n * a thumbnail: for an image whose `url` stops working while its\n * download keeps going (a shared document after its link expires).\n */\n asFile?: boolean\n /**\n * Opens the file in the chat's viewer: a Word document or a\n * spreadsheet the chat stores, with a button beside the download.\n */\n onPreview?: () => void\n /**\n * Asks for this earlier version of the file back as the newest one,\n * with a button before the others.\n */\n onRestore?: () => void\n }>()\n\n defineEmits<{\n remove: []\n }>()\n\n const onOpenClick = (event: MouseEvent) => {\n if (!props.onDownload) {\n return\n }\n event.preventDefault()\n void props.onDownload()\n }\n\n const isImage = computed(\n () => !props.asFile && props.mediaType.startsWith('image/'),\n )\n\n // --- File-type identity (icon + accent + human kind label) ---\n\n const extension = computed(() => {\n const name = props.filename ?? ''\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''\n })\n\n // mediaType subtype, e.g. \"pdf\" from \"application/pdf\"\n const subtype = computed(\n () => props.mediaType.split('/')[1]?.split(';')[0] ?? '',\n )\n\n type FileKind = {\n icon: string\n // CSS color driving the icon glyph + tile tint\n accent: string\n label: string\n }\n\n const KINDS: Array<{ test: RegExp; kind: FileKind }> = [\n {\n test: /pdf/,\n kind: {\n icon: 'ri:file-pdf-2-line',\n accent: '#e2483d',\n label: 'PDF',\n },\n },\n {\n // Match Word specifically: the generic `document` substring also\n // appears in the XLSX/PPTX OOXML mime types (…officedocument…), so\n // matching it here would mis-label spreadsheets/decks as Word.\n test: /msword|wordprocessingml/,\n kind: {\n icon: 'ri:file-word-2-line',\n accent: '#2b7de9',\n label: 'Word',\n },\n },\n {\n test: /sheet|excel|csv/,\n kind: {\n icon: 'ri:file-excel-2-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n },\n },\n {\n test: /presentation|powerpoint/,\n kind: {\n icon: 'ri:file-ppt-2-line',\n accent: '#d98324',\n label: 'Presentation',\n },\n },\n {\n test: /zip|compressed|x-7z|x-rar|x-tar|gzip/,\n kind: {\n icon: 'ri:file-zip-line',\n accent: '#c08a1e',\n label: 'Archive',\n },\n },\n {\n // Reached only by an image drawn as a file (`asFile`).\n test: /^image\\//,\n kind: {\n icon: 'ri:image-2-line',\n accent: '#0ea5e9',\n label: 'Image',\n },\n },\n {\n test: /^audio\\//,\n kind: {\n icon: 'ri:file-music-line',\n accent: '#8b5cf6',\n label: 'Audio',\n },\n },\n {\n test: /^video\\//,\n kind: {\n icon: 'ri:film-line',\n accent: '#6366f1',\n label: 'Video',\n },\n },\n {\n // The code an agent can take (`SUPPORTED_CODE_TYPES`).\n test: /json|javascript|typescript|xml|html|css|yaml|toml|sql|x-(?:sh|python|java|kotlin|c|csharp|go|rust|ruby|php|swift|vue)\\b/,\n kind: {\n icon: 'ri:file-code-line',\n accent: '#0d9488',\n label: 'Code',\n },\n },\n {\n test: /^text\\//,\n kind: {\n icon: 'ri:file-text-line',\n accent: '#64748b',\n label: 'Text',\n },\n },\n ]\n\n const fileKind = computed<FileKind>(() => {\n const haystack = `${props.mediaType} ${extension.value}`\n for (const { test, kind } of KINDS) {\n if (test.test(haystack)) {\n return kind\n }\n }\n return {\n icon: 'ri:file-line',\n accent: '#64748b',\n label: 'File',\n }\n })\n\n // Short type tag shown in the meta line: prefer the real extension, fall\n // back to the mime subtype, then the generic kind label.\n const typeTag = computed(() =>\n (\n extension.value ||\n subtype.value ||\n fileKind.value.label\n ).toUpperCase(),\n )\n\n // --- Size & dimensions ---\n\n const formattedSize = computed(() => {\n const bytes = props.size\n if (bytes === undefined || bytes < 0) {\n return undefined\n }\n if (bytes < 1024) {\n return `${bytes} B`\n }\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let unitIndex = 0\n while (value >= 1024 && unitIndex < units.length - 1) {\n value /= 1024\n unitIndex += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unitIndex]}`\n })\n\n // Thumbnail load lifecycle. Driving the spinner and the error fallback\n // off the real <img> events (not a second background fetch) means the\n // image is requested exactly once and reuses the browser cache on any\n // later re-render, instead of re-downloading every time the message list\n // repaints.\n // Not `useImageFallback`: this tile also needs `loading` vs `loaded` and the\n // decoded dimensions, cached across remounts, so the error flag is one field\n // of a richer per-url entry rather than a standalone broken-url set.\n type ThumbStatus = 'loading' | 'loaded' | 'error'\n\n // Module-level, keyed by URL: survives component recreation. In polled\n // views (e.g. admin chat-logs, refreshed every few seconds) the whole\n // message array is replaced on each poll, so this component can be torn\n // down and rebuilt. Seeding from the cache means a URL that already\n // decoded starts in `loaded` (no spinner flash, no re-decode) instead of\n // flickering back through `loading`. This is a client-side, per-session\n // cache (no server/Redis involved); bounded to a max size so a long-lived\n // session browsing many images can't grow it without limit — the oldest\n // entry is evicted first (Map preserves insertion order).\n type ThumbEntry = {\n status: ThumbStatus\n dimensions?: { width: number; height: number }\n }\n const THUMB_CACHE_MAX = 300\n const thumbCache = new Map<string, ThumbEntry>()\n const setThumbCache = (url: string, entry: ThumbEntry) => {\n // Re-insert to mark as most-recently used, then trim from the front.\n thumbCache.delete(url)\n thumbCache.set(url, entry)\n if (thumbCache.size > THUMB_CACHE_MAX) {\n thumbCache.delete(thumbCache.keys().next().value as string)\n }\n }\n\n const cached = thumbCache.get(props.url)\n const thumbStatus = ref<ThumbStatus>(cached?.status ?? 'loading')\n\n // Natural pixel dimensions, captured once the thumbnail decodes. Doubles\n // as the size hint PhotoSwipe needs for its slide (falls back until known).\n const dimensions = ref<{ width: number; height: number } | undefined>(\n cached?.dimensions,\n )\n const onImageLoad = (event: Event) => {\n const img = event.target as HTMLImageElement\n if (img.naturalWidth && img.naturalHeight) {\n dimensions.value = {\n width: img.naturalWidth,\n height: img.naturalHeight,\n }\n }\n thumbStatus.value = 'loaded'\n setThumbCache(props.url, {\n status: 'loaded',\n dimensions: dimensions.value,\n })\n }\n const onImageError = () => {\n thumbStatus.value = 'error'\n setThumbCache(props.url, { status: 'error' })\n }\n\n const pswpSize = computed(() => dimensions.value ?? DEFAULT_PSWP_SIZE)\n\n // Meta fragments joined with \" · \" for the caption / doc subtitle.\n const imageMeta = computed(() =>\n [\n dimensions.value &&\n `${dimensions.value.width}×${dimensions.value.height}`,\n formattedSize.value,\n ].filter(Boolean),\n )\n const docMeta = computed(() =>\n [typeTag.value, formattedSize.value].filter(Boolean),\n )\n\n // --- Lightbox ---\n\n // Slide size PhotoSwipe assumes before the real dimensions are known.\n const DEFAULT_PSWP_SIZE = { width: 1200, height: 800 }\n\n // In a conversation the image opens in its lightbox, with the others\n const galleryRef = ref<HTMLElement>()\n const { init, shared } = useLightbox({\n gallery: galleryRef,\n loop: false,\n shared: true,\n })\n\n onMounted(async () => {\n if (!isImage.value) {\n return\n }\n await init()\n })\n</script>\n\n<template>\n <!-- Image attachment: a thumbnail tile with a metadata caption -->\n <figure\n v-if=\"isImage\"\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--image\"\n :class=\"{ 'pk-chatbot-file-preview--compact': compact }\">\n <div ref=\"galleryRef\" class=\"pk-chatbot-file-preview__thumb-wrap\">\n <a\n :href=\"url\"\n :data-pswp-src=\"url\"\n :data-pswp-width=\"pswpSize.width\"\n :data-pswp-height=\"pswpSize.height\"\n :data-pswp-caption=\"filename ?? ''\"\n :data-pswp-shared=\"shared || undefined\"\n class=\"pk-chatbot-file-preview__thumb-link\"\n :aria-label=\"filename ?? $t('label.file')\">\n <img\n v-show=\"thumbStatus === 'loaded'\"\n :src=\"url\"\n :alt=\"filename\"\n decoding=\"async\"\n class=\"pk-chatbot-file-preview__thumb\"\n @load=\"onImageLoad\"\n @error=\"onImageError\" />\n </a>\n <!-- Spinner until the thumbnail decodes (or while an upload is in\n flight); a fixed box keeps this from shifting the layout. -->\n <span\n v-if=\"loading || thumbStatus === 'loading'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay\">\n <VvIcon name=\"loading-loop\" />\n </span>\n <!-- Failed to load: a quiet icon instead of the browser's broken\n image glyph. -->\n <span\n v-else-if=\"thumbStatus === 'error'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error\">\n <VvIcon name=\"ri:image-2-line\" />\n </span>\n </div>\n <figcaption v-if=\"!compact\" class=\"pk-chatbot-file-preview__caption\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ imageMeta.join(' · ') }}</template>\n </span>\n </figcaption>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click.prevent=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </figure>\n\n <!-- Document attachment: an icon tile + name + type · size -->\n <div\n v-else\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--doc\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n 'pk-chatbot-file-preview--show-download': showDownload,\n }\">\n <span\n class=\"pk-chatbot-file-preview__icon-tile\"\n :style=\"{ '--file-accent': fileKind.accent }\">\n <VvIcon\n v-if=\"loading\"\n name=\"loading-loop\"\n class=\"pk-chatbot-file-preview__icon\" />\n <VvIcon\n v-else\n :name=\"fileKind.icon\"\n class=\"pk-chatbot-file-preview__icon\" />\n </span>\n <span class=\"pk-chatbot-file-preview__body\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ docMeta.join(' · ') }}</template>\n </span>\n </span>\n <!-- The actions of a file the chat's viewer opens: a small bar of\n their own, apart from the name and the size -->\n <span\n v-if=\"!loading && !error && !compact\"\n class=\"pk-chatbot-file-preview__actions\"\n :class=\"{\n 'pk-chatbot-file-preview__actions--bar': onPreview || onRestore,\n }\">\n <button\n v-if=\"onRestore\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.restore')\"\n :aria-label=\"`${$t('chatFilePreview.restore')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onRestore\">\n <VvIcon name=\"ri:arrow-go-back-line\" />\n </button>\n <button\n v-if=\"onPreview\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.open')\"\n :aria-label=\"`${$t('chatFilePreview.open')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onPreview\">\n <VvIcon name=\"ri:eye-line\" />\n </button>\n <a\n :href=\"url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('action.download')\"\n :aria-label=\"`${$t('action.download')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onOpenClick\">\n <VvIcon name=\"ri:download-2-line\" />\n </a>\n </span>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :class=\"{ 'pk-chatbot-file-preview__remove--inline': !compact }\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-file-preview {\n // Concentric radii: outer card and inner tiles share an 8px step.\n --file-radius: var(--rounded-lg, 12px);\n\n position: relative;\n max-width: 280px;\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--file-radius);\n color: var(--color-word-2);\n font-size: var(--text-12);\n\n &--error {\n border-color: var(--color-danger);\n }\n\n // --- Document card ---\n &--doc {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n min-width: 0;\n transition:\n border-color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out),\n box-shadow 0.18s var(--ease-out);\n\n &:hover {\n border-color: var(--color-surface-4);\n background-color: var(--color-surface-2);\n box-shadow: var(--shadow-sm);\n }\n }\n\n &__icon-tile {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-36);\n height: var(--spacing-36);\n\n // One step down from the card radius keeps the nested tile concentric.\n border-radius: var(--rounded-md, 6px);\n\n // Tint derived from the file-type accent; glyph sits at full accent.\n background-color: color-mix(\n in srgb,\n var(--file-accent) 14%,\n transparent\n );\n color: var(--file-accent);\n }\n\n &__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n\n &__body {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n flex: 1;\n }\n\n &__actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n margin-inline-start: var(--spacing-4);\n }\n\n // Restore, open and download of a file the viewer opens: one small\n // bar, its hairline setting it apart from the name and the size, the\n // icons 8px apart so they read as a group\n &__actions--bar {\n margin-inline-start: var(--spacing-8);\n padding: var(--spacing-2);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n }\n\n // 28px to aim at with a mouse, 24 in the bar; 40px under a finger\n // (u-touch-target)\n &__open {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: 0;\n border-radius: var(--rounded);\n background: none;\n color: var(--color-word-3);\n text-decoration: none;\n cursor: pointer;\n opacity: 0;\n transition:\n opacity 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n\n .vv-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &__actions--bar &__open {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &--doc:hover &__open,\n &--doc:focus-within &__open,\n &--show-download &__open {\n opacity: 1;\n }\n\n // Touch devices have no hover: keep the open affordance visible.\n @media (hover: none) {\n &--doc &__open {\n opacity: 1;\n }\n }\n\n // --- Image card ---\n &--image {\n display: inline-flex;\n flex-direction: column;\n margin: 0;\n }\n\n &__thumb-wrap {\n position: relative;\n display: flex;\n\n // Fixed box: the card claims its final footprint before the\n // image decodes, so the message log never shifts on load.\n width: 280px;\n max-width: 100%;\n height: 200px;\n background-color: var(--color-surface);\n border-radius: var(--file-radius);\n overflow: hidden;\n }\n\n &__thumb-link {\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n }\n\n &__thumb {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__caption {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: var(--spacing-8);\n min-width: 0;\n }\n\n &__name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: var(--font-medium, 500);\n color: var(--color-word-1);\n }\n\n &__meta {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--text-10);\n line-height: var(--leading-normal);\n\n // Reserve the line even while empty: image dimensions arrive\n // only after decode and must not grow the caption.\n min-height: 1.4em;\n color: var(--color-word-4);\n\n // Stable column for the dimensions/size figures.\n font-variant-numeric: tabular-nums;\n }\n\n &__error {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n color: var(--u-danger-text, var(--color-danger));\n\n .vv-icon {\n flex-shrink: 0;\n }\n }\n\n &__status {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n .vv-icon {\n width: var(--spacing-32);\n height: var(--spacing-32);\n }\n\n &--overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 70%,\n transparent\n );\n color: var(--color-word-1);\n }\n\n &--error {\n color: var(--color-word-4);\n }\n }\n\n // --- Remove button (input context) ---\n &__remove {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: flex;\n align-items: center;\n justify-content: center;\n\n // Visible glyph is 18px but the hit area stays a comfortable 28px.\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: none;\n border-radius: var(--rounded-full, 9999px);\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n color: var(--color-word-2);\n cursor: pointer;\n line-height: 1;\n box-shadow: var(--shadow-sm);\n transition:\n background-color 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n scale 0.12s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n\n &:active {\n scale: 0.96;\n }\n\n // Inside the document row the button rides inline, not overlaid\n // (size is inherited from the base).\n &--inline {\n position: static;\n flex-shrink: 0;\n box-shadow: none;\n background-color: transparent;\n color: var(--color-word-4);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n }\n }\n\n // --- Compact (composer) chips ---\n // ChatGPT/Gemini-style: every attachment is the SAME height and carries\n // an always-visible round remove control in the top-right corner — no\n // hover-revealed actions, no size mismatch between image and file chips.\n &--compact {\n // Shared chip height so image and file chips align in the row.\n --chip-size: var(--spacing-56);\n\n max-width: 240px;\n\n &.pk-chatbot-file-preview--image {\n width: var(--chip-size);\n height: var(--chip-size);\n border-radius: var(--rounded-md, 6px);\n }\n\n // Fill the square; the root's `overflow: hidden` rounds the corners.\n .pk-chatbot-file-preview__thumb-wrap,\n .pk-chatbot-file-preview__thumb-link {\n width: 100%;\n height: 100%;\n }\n\n &.pk-chatbot-file-preview--doc {\n height: var(--chip-size);\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n\n // Reserve room so the corner remove button never overlaps the\n // name/meta text.\n padding-inline-end: var(--spacing-28);\n }\n\n // Square icon tile that fills the chip height, so file chips read at\n // the same scale as image thumbnails: the chip less its padding and\n // its two 1px borders. Not `align-self: stretch` with `aspect-ratio`,\n // which Safari sizes from the chip's outer height, so the tile ran\n // past the chip's bottom edge.\n .pk-chatbot-file-preview__icon-tile {\n --chip-tile-size: calc(\n var(--chip-size) - 2 * var(--spacing-8) - 2px\n );\n\n width: var(--chip-tile-size);\n height: var(--chip-tile-size);\n }\n\n .pk-chatbot-file-preview__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n // Always-visible round remove control in the top-right corner. Sits\n // just inside the chip (an ancestor clips overflow), bigger than before,\n // with an extended hit area for easy tapping.\n &--compact &__remove {\n top: var(--spacing-4);\n right: var(--spacing-4);\n width: var(--spacing-24);\n height: var(--spacing-24);\n border: 1px solid var(--color-surface-4);\n background-color: var(--color-surface);\n color: var(--color-word-1);\n font-size: var(--text-16);\n box-shadow: var(--shadow-sm);\n\n // Comfortable touch/click target beyond the small visible glyph.\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-4));\n }\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n &--doc,\n &__open,\n &__remove {\n transition: none;\n }\n }\n }\n</style>\n","<script lang=\"ts\" setup>\n import { computed, ref, onMounted } from 'vue'\n import { useLightbox } from '../composables/useLightbox'\n\n const props = defineProps<{\n mediaType: string\n url: string\n filename?: string\n /** Size in bytes, when known (e.g. local uploads). */\n size?: number\n loading?: boolean\n error?: string\n removable?: boolean\n /**\n * Dense layout for the composer: a small square thumbnail / slim row,\n * without the metadata caption. The full card is reserved for the\n * message log where the details matter.\n */\n compact?: boolean\n /**\n * Keeps the download button visible instead of revealing it on hover:\n * for a file the agent wrote, which the user is there to download.\n */\n showDownload?: boolean\n /**\n * Replaces the download link of a document with a call, for a file\n * whose download URL is minted on demand (a knowledge base document\n * shared in the chat). `url` stays the link's `href`.\n */\n onDownload?: () => void | Promise<void>\n /**\n * Draws an image as a file row, with its download button, instead of\n * a thumbnail: for an image whose `url` stops working while its\n * download keeps going (a shared document after its link expires).\n */\n asFile?: boolean\n /**\n * Opens the file in the chat's viewer: a Word document or a\n * spreadsheet the chat stores, with a button beside the download.\n */\n onPreview?: () => void\n /**\n * Asks for this earlier version of the file back as the newest one,\n * with a button before the others.\n */\n onRestore?: () => void\n }>()\n\n defineEmits<{\n remove: []\n }>()\n\n const onOpenClick = (event: MouseEvent) => {\n if (!props.onDownload) {\n return\n }\n event.preventDefault()\n void props.onDownload()\n }\n\n const isImage = computed(\n () => !props.asFile && props.mediaType.startsWith('image/'),\n )\n\n // --- File-type identity (icon + accent + human kind label) ---\n\n const extension = computed(() => {\n const name = props.filename ?? ''\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(dot + 1).toLowerCase() : ''\n })\n\n // mediaType subtype, e.g. \"pdf\" from \"application/pdf\"\n const subtype = computed(\n () => props.mediaType.split('/')[1]?.split(';')[0] ?? '',\n )\n\n type FileKind = {\n icon: string\n // CSS color driving the icon glyph + tile tint\n accent: string\n label: string\n }\n\n const KINDS: Array<{ test: RegExp; kind: FileKind }> = [\n {\n test: /pdf/,\n kind: {\n icon: 'ri:file-pdf-2-line',\n accent: '#e2483d',\n label: 'PDF',\n },\n },\n {\n // Match Word specifically: the generic `document` substring also\n // appears in the XLSX/PPTX OOXML mime types (…officedocument…), so\n // matching it here would mis-label spreadsheets/decks as Word.\n test: /msword|wordprocessingml/,\n kind: {\n icon: 'ri:file-word-2-line',\n accent: '#2b7de9',\n label: 'Word',\n },\n },\n {\n test: /sheet|excel|csv/,\n kind: {\n icon: 'ri:file-excel-2-line',\n accent: '#1f9d57',\n label: 'Spreadsheet',\n },\n },\n {\n test: /presentation|powerpoint/,\n kind: {\n icon: 'ri:file-ppt-2-line',\n accent: '#d98324',\n label: 'Presentation',\n },\n },\n {\n test: /zip|compressed|x-7z|x-rar|x-tar|gzip/,\n kind: {\n icon: 'ri:file-zip-line',\n accent: '#c08a1e',\n label: 'Archive',\n },\n },\n {\n // Reached only by an image drawn as a file (`asFile`).\n test: /^image\\//,\n kind: {\n icon: 'ri:image-2-line',\n accent: '#0ea5e9',\n label: 'Image',\n },\n },\n {\n test: /^audio\\//,\n kind: {\n icon: 'ri:file-music-line',\n accent: '#8b5cf6',\n label: 'Audio',\n },\n },\n {\n test: /^video\\//,\n kind: {\n icon: 'ri:film-line',\n accent: '#6366f1',\n label: 'Video',\n },\n },\n {\n // The code an agent can take (`SUPPORTED_CODE_TYPES`).\n test: /json|javascript|typescript|xml|html|css|yaml|toml|sql|x-(?:sh|python|java|kotlin|c|csharp|go|rust|ruby|php|swift|vue)\\b/,\n kind: {\n icon: 'ri:file-code-line',\n accent: '#0d9488',\n label: 'Code',\n },\n },\n {\n test: /^text\\//,\n kind: {\n icon: 'ri:file-text-line',\n accent: '#64748b',\n label: 'Text',\n },\n },\n ]\n\n const fileKind = computed<FileKind>(() => {\n const haystack = `${props.mediaType} ${extension.value}`\n for (const { test, kind } of KINDS) {\n if (test.test(haystack)) {\n return kind\n }\n }\n return {\n icon: 'ri:file-line',\n accent: '#64748b',\n label: 'File',\n }\n })\n\n // Short type tag shown in the meta line: prefer the real extension, fall\n // back to the mime subtype, then the generic kind label.\n const typeTag = computed(() =>\n (\n extension.value ||\n subtype.value ||\n fileKind.value.label\n ).toUpperCase(),\n )\n\n // --- Size & dimensions ---\n\n const formattedSize = computed(() => {\n const bytes = props.size\n if (bytes === undefined || bytes < 0) {\n return undefined\n }\n if (bytes < 1024) {\n return `${bytes} B`\n }\n const units = ['KB', 'MB', 'GB', 'TB']\n let value = bytes / 1024\n let unitIndex = 0\n while (value >= 1024 && unitIndex < units.length - 1) {\n value /= 1024\n unitIndex += 1\n }\n return `${value < 10 ? value.toFixed(1) : Math.round(value)} ${units[unitIndex]}`\n })\n\n // Thumbnail load lifecycle. Driving the spinner and the error fallback\n // off the real <img> events (not a second background fetch) means the\n // image is requested exactly once and reuses the browser cache on any\n // later re-render, instead of re-downloading every time the message list\n // repaints.\n // Not `useImageFallback`: this tile also needs `loading` vs `loaded` and the\n // decoded dimensions, cached across remounts, so the error flag is one field\n // of a richer per-url entry rather than a standalone broken-url set.\n type ThumbStatus = 'loading' | 'loaded' | 'error'\n\n // Module-level, keyed by URL: survives component recreation. In polled\n // views (e.g. admin chat-logs, refreshed every few seconds) the whole\n // message array is replaced on each poll, so this component can be torn\n // down and rebuilt. Seeding from the cache means a URL that already\n // decoded starts in `loaded` (no spinner flash, no re-decode) instead of\n // flickering back through `loading`. This is a client-side, per-session\n // cache (no server/Redis involved); bounded to a max size so a long-lived\n // session browsing many images can't grow it without limit — the oldest\n // entry is evicted first (Map preserves insertion order).\n type ThumbEntry = {\n status: ThumbStatus\n dimensions?: { width: number; height: number }\n }\n const THUMB_CACHE_MAX = 300\n const thumbCache = new Map<string, ThumbEntry>()\n const setThumbCache = (url: string, entry: ThumbEntry) => {\n // Re-insert to mark as most-recently used, then trim from the front.\n thumbCache.delete(url)\n thumbCache.set(url, entry)\n if (thumbCache.size > THUMB_CACHE_MAX) {\n thumbCache.delete(thumbCache.keys().next().value as string)\n }\n }\n\n const cached = thumbCache.get(props.url)\n const thumbStatus = ref<ThumbStatus>(cached?.status ?? 'loading')\n\n // Natural pixel dimensions, captured once the thumbnail decodes. Doubles\n // as the size hint PhotoSwipe needs for its slide (falls back until known).\n const dimensions = ref<{ width: number; height: number } | undefined>(\n cached?.dimensions,\n )\n const onImageLoad = (event: Event) => {\n const img = event.target as HTMLImageElement\n if (img.naturalWidth && img.naturalHeight) {\n dimensions.value = {\n width: img.naturalWidth,\n height: img.naturalHeight,\n }\n }\n thumbStatus.value = 'loaded'\n setThumbCache(props.url, {\n status: 'loaded',\n dimensions: dimensions.value,\n })\n }\n const onImageError = () => {\n thumbStatus.value = 'error'\n setThumbCache(props.url, { status: 'error' })\n }\n\n const pswpSize = computed(() => dimensions.value ?? DEFAULT_PSWP_SIZE)\n\n // Meta fragments joined with \" · \" for the caption / doc subtitle.\n const imageMeta = computed(() =>\n [\n dimensions.value &&\n `${dimensions.value.width}×${dimensions.value.height}`,\n formattedSize.value,\n ].filter(Boolean),\n )\n const docMeta = computed(() =>\n [typeTag.value, formattedSize.value].filter(Boolean),\n )\n\n // --- Lightbox ---\n\n // Slide size PhotoSwipe assumes before the real dimensions are known.\n const DEFAULT_PSWP_SIZE = { width: 1200, height: 800 }\n\n // In a conversation the image opens in its lightbox, with the others\n const galleryRef = ref<HTMLElement>()\n const { init, shared } = useLightbox({\n gallery: galleryRef,\n loop: false,\n shared: true,\n })\n\n onMounted(async () => {\n if (!isImage.value) {\n return\n }\n await init()\n })\n</script>\n\n<template>\n <!-- Image attachment: a thumbnail tile with a metadata caption -->\n <figure\n v-if=\"isImage\"\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--image\"\n :class=\"{ 'pk-chatbot-file-preview--compact': compact }\">\n <div ref=\"galleryRef\" class=\"pk-chatbot-file-preview__thumb-wrap\">\n <a\n :href=\"url\"\n :data-pswp-src=\"url\"\n :data-pswp-width=\"pswpSize.width\"\n :data-pswp-height=\"pswpSize.height\"\n :data-pswp-caption=\"filename ?? ''\"\n :data-pswp-shared=\"shared || undefined\"\n class=\"pk-chatbot-file-preview__thumb-link\"\n :aria-label=\"filename ?? $t('label.file')\">\n <img\n v-show=\"thumbStatus === 'loaded'\"\n :src=\"url\"\n :alt=\"filename\"\n decoding=\"async\"\n class=\"pk-chatbot-file-preview__thumb\"\n @load=\"onImageLoad\"\n @error=\"onImageError\" />\n </a>\n <!-- Spinner until the thumbnail decodes (or while an upload is in\n flight); a fixed box keeps this from shifting the layout. -->\n <span\n v-if=\"loading || thumbStatus === 'loading'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay\">\n <VvIcon name=\"loading-loop\" />\n </span>\n <!-- Failed to load: a quiet icon instead of the browser's broken\n image glyph. -->\n <span\n v-else-if=\"thumbStatus === 'error'\"\n class=\"pk-chatbot-file-preview__status pk-chatbot-file-preview__status--overlay pk-chatbot-file-preview__status--error\">\n <VvIcon name=\"ri:image-2-line\" />\n </span>\n </div>\n <figcaption v-if=\"!compact\" class=\"pk-chatbot-file-preview__caption\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ imageMeta.join(' · ') }}</template>\n </span>\n </figcaption>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click.prevent=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </figure>\n\n <!-- Document attachment: an icon tile + name + type · size -->\n <div\n v-else\n class=\"pk-chatbot-file-preview pk-chatbot-file-preview--doc\"\n :class=\"{\n 'pk-chatbot-file-preview--error': error,\n 'pk-chatbot-file-preview--compact': compact,\n 'pk-chatbot-file-preview--show-download': showDownload,\n }\">\n <span\n class=\"pk-chatbot-file-preview__icon-tile\"\n :style=\"{ '--file-accent': fileKind.accent }\">\n <VvIcon\n v-if=\"loading\"\n name=\"loading-loop\"\n class=\"pk-chatbot-file-preview__icon\" />\n <VvIcon\n v-else\n :name=\"fileKind.icon\"\n class=\"pk-chatbot-file-preview__icon\" />\n </span>\n <span class=\"pk-chatbot-file-preview__body\">\n <span\n v-if=\"filename\"\n class=\"pk-chatbot-file-preview__name\"\n :title=\"filename\"\n >{{ filename }}</span\n >\n <span class=\"pk-chatbot-file-preview__meta\">\n <span\n v-if=\"error\"\n class=\"pk-chatbot-file-preview__error\"\n :title=\"error\">\n <VvIcon name=\"ri:error-warning-line\" />\n {{ error }}\n </span>\n <template v-else>{{ docMeta.join(' · ') }}</template>\n </span>\n </span>\n <!-- The actions of a file the chat's viewer opens: a small bar of\n their own, apart from the name and the size -->\n <span\n v-if=\"!loading && !error && !compact\"\n class=\"pk-chatbot-file-preview__actions\"\n :class=\"{\n 'pk-chatbot-file-preview__actions--bar': onPreview || onRestore,\n }\">\n <button\n v-if=\"onRestore\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.restore')\"\n :aria-label=\"`${$t('chatFilePreview.restore')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onRestore\">\n <VvIcon name=\"ri:arrow-go-back-line\" />\n </button>\n <button\n v-if=\"onPreview\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('chatFilePreview.open')\"\n :aria-label=\"`${$t('chatFilePreview.open')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onPreview\">\n <VvIcon name=\"ri:eye-line\" />\n </button>\n <a\n :href=\"url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n class=\"pk-chatbot-file-preview__open u-touch-target\"\n :title=\"$t('action.download')\"\n :aria-label=\"`${$t('action.download')}${filename ? ` — ${filename}` : ''}`\"\n @click=\"onOpenClick\">\n <VvIcon name=\"ri:download-2-line\" />\n </a>\n </span>\n <button\n v-if=\"removable && !loading\"\n type=\"button\"\n class=\"pk-chatbot-file-preview__remove\"\n :class=\"{ 'pk-chatbot-file-preview__remove--inline': !compact }\"\n :title=\"$t('action.remove')\"\n :aria-label=\"$t('action.remove')\"\n @click=\"$emit('remove')\">\n <VvIcon name=\"ri:close-line\" />\n </button>\n </div>\n</template>\n\n<style lang=\"scss\">\n .pk-chatbot-file-preview {\n // Concentric radii: outer card and inner tiles share an 8px step.\n --file-radius: var(--rounded-lg, 12px);\n\n position: relative;\n max-width: 280px;\n background-color: var(--color-surface-1);\n border: 1px solid var(--color-surface-3);\n border-radius: var(--file-radius);\n color: var(--color-word-2);\n font-size: var(--text-12);\n\n &--error {\n border-color: var(--color-danger);\n }\n\n // --- Document card ---\n &--doc {\n display: flex;\n align-items: center;\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n min-width: 0;\n transition:\n border-color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out),\n box-shadow 0.18s var(--ease-out);\n\n &:hover {\n border-color: var(--color-surface-4);\n background-color: var(--color-surface-2);\n box-shadow: var(--shadow-sm);\n }\n }\n\n &__icon-tile {\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-36);\n height: var(--spacing-36);\n\n // One step down from the card radius keeps the nested tile concentric.\n border-radius: var(--rounded-md, 6px);\n\n // Tint derived from the file-type accent; glyph sits at full accent.\n background-color: color-mix(\n in srgb,\n var(--file-accent) 14%,\n transparent\n );\n color: var(--file-accent);\n }\n\n &__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n\n &__body {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n flex: 1;\n }\n\n &__actions {\n display: flex;\n flex-shrink: 0;\n align-items: center;\n margin-inline-start: var(--spacing-4);\n }\n\n // Restore, open and download of a file the viewer opens: one small\n // bar, its hairline setting it apart from the name and the size, the\n // icons 8px apart so they read as a group\n &__actions--bar {\n margin-inline-start: var(--spacing-8);\n padding: var(--spacing-2);\n border: var(--border) solid var(--color-surface-3);\n border-radius: var(--rounded);\n }\n\n // 28px to aim at with a mouse, 24 in the bar; 40px under a finger\n // (u-touch-target)\n &__open {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: 0;\n border-radius: var(--rounded);\n background: none;\n color: var(--color-word-3);\n text-decoration: none;\n cursor: pointer;\n opacity: 0;\n transition:\n opacity 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n background-color 0.18s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n\n .vv-icon {\n width: var(--spacing-16);\n height: var(--spacing-16);\n }\n }\n\n &__actions--bar &__open {\n width: var(--spacing-24);\n height: var(--spacing-24);\n }\n\n &--doc:hover &__open,\n &--doc:focus-within &__open,\n &--show-download &__open {\n opacity: 1;\n }\n\n // Touch devices have no hover: keep the open affordance visible.\n @media (hover: none) {\n &--doc &__open {\n opacity: 1;\n }\n }\n\n // --- Image card ---\n &--image {\n display: inline-flex;\n flex-direction: column;\n margin: 0;\n }\n\n &__thumb-wrap {\n position: relative;\n display: flex;\n\n // Fixed box: the card claims its final footprint before the\n // image decodes, so the message log never shifts on load.\n width: 280px;\n max-width: 100%;\n height: 200px;\n background-color: var(--color-surface);\n border-radius: var(--file-radius);\n overflow: hidden;\n }\n\n &__thumb-link {\n display: flex;\n width: 100%;\n height: 100%;\n cursor: pointer;\n }\n\n &__thumb {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n &__caption {\n display: flex;\n flex-direction: column;\n gap: 1px;\n padding: var(--spacing-8);\n min-width: 0;\n }\n\n &__name {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-weight: var(--font-medium, 500);\n color: var(--color-word-1);\n }\n\n &__meta {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n font-size: var(--text-10);\n line-height: var(--leading-normal);\n\n // Reserve the line even while empty: image dimensions arrive\n // only after decode and must not grow the caption.\n min-height: 1.4em;\n color: var(--color-word-4);\n\n // Stable column for the dimensions/size figures.\n font-variant-numeric: tabular-nums;\n }\n\n &__error {\n display: inline-flex;\n align-items: center;\n gap: var(--spacing-4);\n color: var(--u-danger-text, var(--color-danger));\n\n .vv-icon {\n flex-shrink: 0;\n }\n }\n\n &__status {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n .vv-icon {\n width: var(--spacing-32);\n height: var(--spacing-32);\n }\n\n &--overlay {\n position: absolute;\n inset: 0;\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 70%,\n transparent\n );\n color: var(--color-word-1);\n }\n\n &--error {\n color: var(--color-word-4);\n }\n }\n\n // --- Remove button (input context) ---\n &__remove {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: flex;\n align-items: center;\n justify-content: center;\n\n // Visible glyph is 18px but the hit area stays a comfortable 28px.\n width: var(--spacing-28);\n height: var(--spacing-28);\n padding: 0;\n border: none;\n border-radius: var(--rounded-full, 9999px);\n background-color: color-mix(\n in srgb,\n var(--color-surface-1) 85%,\n transparent\n );\n color: var(--color-word-2);\n cursor: pointer;\n line-height: 1;\n box-shadow: var(--shadow-sm);\n transition:\n background-color 0.18s var(--ease-out),\n color 0.18s var(--ease-out),\n scale 0.12s var(--ease-out);\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n\n &:active {\n scale: 0.96;\n }\n\n // Inside the document row the button rides inline, not overlaid\n // (size is inherited from the base).\n &--inline {\n position: static;\n flex-shrink: 0;\n box-shadow: none;\n background-color: transparent;\n color: var(--color-word-4);\n\n &:hover {\n background-color: var(--color-surface-3);\n color: var(--color-word-1);\n }\n }\n }\n\n // --- Compact (composer) chips ---\n // ChatGPT/Gemini-style: every attachment is the SAME height and carries\n // an always-visible round remove control in the top-right corner — no\n // hover-revealed actions, no size mismatch between image and file chips.\n &--compact {\n // Shared chip height so image and file chips align in the row.\n --chip-size: var(--spacing-56);\n\n max-width: 240px;\n\n &.pk-chatbot-file-preview--image {\n width: var(--chip-size);\n height: var(--chip-size);\n border-radius: var(--rounded-md, 6px);\n }\n\n // Fill the square; the root's `overflow: hidden` rounds the corners.\n .pk-chatbot-file-preview__thumb-wrap,\n .pk-chatbot-file-preview__thumb-link {\n width: 100%;\n height: 100%;\n }\n\n &.pk-chatbot-file-preview--doc {\n height: var(--chip-size);\n gap: var(--spacing-8);\n padding: var(--spacing-8);\n\n // Reserve room so the corner remove button never overlaps the\n // name/meta text.\n padding-inline-end: var(--spacing-28);\n }\n\n // Square icon tile that fills the chip height, so file chips read at\n // the same scale as image thumbnails: the chip less its padding and\n // its two 1px borders. Not `align-self: stretch` with `aspect-ratio`,\n // which Safari sizes from the chip's outer height, so the tile ran\n // past the chip's bottom edge.\n .pk-chatbot-file-preview__icon-tile {\n --chip-tile-size: calc(\n var(--chip-size) - 2 * var(--spacing-8) - 2px\n );\n\n width: var(--chip-tile-size);\n height: var(--chip-tile-size);\n }\n\n .pk-chatbot-file-preview__icon {\n width: var(--spacing-20);\n height: var(--spacing-20);\n }\n }\n\n // Always-visible round remove control in the top-right corner. Sits\n // just inside the chip (an ancestor clips overflow), bigger than before,\n // with an extended hit area for easy tapping.\n &--compact &__remove {\n top: var(--spacing-4);\n right: var(--spacing-4);\n width: var(--spacing-24);\n height: var(--spacing-24);\n border: 1px solid var(--color-surface-4);\n background-color: var(--color-surface);\n color: var(--color-word-1);\n font-size: var(--text-16);\n box-shadow: var(--shadow-sm);\n\n // Comfortable touch/click target beyond the small visible glyph.\n &::after {\n content: '';\n position: absolute;\n inset: calc(-1 * var(--spacing-4));\n }\n\n &:hover {\n background-color: var(--color-surface-2);\n color: var(--color-word-1);\n }\n }\n\n @media (prefers-reduced-motion: reduce) {\n &--doc,\n &__open,\n &__remove {\n transition: none;\n }\n }\n }\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;A,gCA+OU+D,IAAkB,K;;;;;;;;;;;;;;;;;;;EA3OxB,IAAME,IAAQC,GAgDRC,KAAe,MAAsB;GACvC,AAAKF,EAAM,eAGXG,EAAM,eAAe,GACrBH,EAAW,WAAW;EAC1B,GAEMI,IAAUvC,QACN,CAACmC,EAAM,UAAUA,EAAM,UAAU,WAAW,QAAQ,CAC9D,GAIMK,IAAYxC,QAAe;GAC7B,IAAMyC,IAAON,EAAM,YAAY,IACzBO,IAAMD,EAAK,YAAY,GAAG;GAChC,OAAOC,IAAM,IAAID,EAAK,MAAMC,IAAM,CAAC,CAAC,CAAC,YAAY,IAAI;EACzD,CAAC,GAGKC,IAAU3C,QACNmC,EAAM,UAAU,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAC1D,GASMS,IAAiD;GACnD;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IAII,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IAEI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IAEI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;GACA;IACI,MAAM;IACN,MAAM;KACF,MAAM;KACN,QAAQ;KACR,OAAO;IACX;GACJ;EACJ,GAEMC,IAAW7C,QAAyB;GACtC,IAAM8C,IAAW,GAAGX,EAAM,UAAU,GAAGK,EAAU;GACjD,KAAK,IAAM,EAAE,SAAM,aAAUI,GACzB,IAAIG,EAAK,KAAKD,CAAQ,GAClB,OAAOE;GAGf,OAAO;IACH,MAAM;IACN,QAAQ;IACR,OAAO;GACX;EACJ,CAAC,GAIKC,IAAUjD,SAERwC,EAAU,SACVG,EAAQ,SACRE,EAAS,MAAM,MAAA,CACjB,YAAY,CAClB,GAIMK,IAAgBlD,QAAe;GACjC,IAAMmD,IAAQhB,EAAM;GACpB,IAAIgB,MAAU,KAAA,KAAaA,IAAQ,GAC/B;GAEJ,IAAIA,IAAQ,MACR,OAAO,GAAGA,EAAM;GAEpB,IAAMC,IAAQ;IAAC;IAAM;IAAM;IAAM;GAAI,GACjCC,IAAQF,IAAQ,MAChBG,IAAY;GAChB,OAAOD,KAAS,QAAQC,IAAYF,EAAM,SAAS,IAE/C,AADA,KAAS,MACT,KAAa;GAEjB,OAAO,GAAGC,IAAQ,KAAKA,EAAM,QAAQ,CAAC,IAAI,KAAK,MAAMA,CAAK,EAAE,GAAGD,EAAME;EACzE,CAAC,GA0BKC,oBAAa,IAAI,IAAwB,GACzCC,KAAiB,GAAa,MAAsB;GAItD,AAFAD,EAAW,OAAOE,CAAG,GACrBF,EAAW,IAAIE,GAAKC,CAAK,GACrBH,EAAW,OAAOtB,KAClBsB,EAAW,OAAOA,EAAW,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAe;EAElE,GAEMI,IAASJ,EAAW,IAAIpB,EAAM,GAAG,GACjCyB,IAAc7D,EAAiB4D,GAAQ,UAAU,SAAS,GAI1DE,IAAa9D,EACf4D,GAAQ,UACZ,GACMG,KAAe,MAAiB;GAClC,IAAMC,IAAMzB,EAAM;GAQlB,AAPIyB,EAAI,gBAAgBA,EAAI,kBACxB,EAAW,QAAQ;IACf,OAAOA,EAAI;IACX,QAAQA,EAAI;GAChB,IAEJ,EAAY,QAAQ,UACpBP,EAAcrB,EAAM,KAAK;IACrB,QAAQ;IACR,YAAY0B,EAAW;GAC3B,CAAC;EACL,GACMG,WAAqB;GAEvB,AADA,EAAY,QAAQ,SACpBR,EAAcrB,EAAM,KAAK,EAAE,QAAQ,QAAQ,CAAC;EAChD,GAEM8B,IAAWjE,QAAe6D,EAAW,SAASK,EAAiB,GAG/DC,KAAYnE,QACd,CACI6D,EAAW,SACP,GAAGA,EAAW,MAAM,MAAM,GAAGA,EAAW,MAAM,UAClDX,EAAc,KAClB,CAAC,CAAC,OAAO,OAAO,CACpB,GACMkB,KAAUpE,QACZ,CAACiD,EAAQ,OAAOC,EAAc,KAAK,CAAC,CAAC,OAAO,OAAO,CACvD,GAKMgB,KAAoB;GAAE,OAAO;GAAM,QAAQ;EAAI,GAG/CG,IAAatE,EAAiB,GAC9B,EAAE,UAAM,eAAWgB,EAAY;GACjC,SAASsD;GACT,MAAM;GACN,QAAQ;EACZ,CAAC;E,OAED9E,EAAU,YAAY;GAClB,AAAKgD,EAAQ,SAGb,MAAM+B,GAAK;EACf,CAAC,I;;GAMS,OAAA/B,EAAA,SADVlE,EAAA,GAAAC,EAiES,UAAA;;IA/DL,OAAKC,EAAA,CAAC,0DAAwD,EAAA,oCAChB6D,EAAA,QAAO,CAAA,CAAA;;IACrD5D,EAiCM,OAAA;KAjCG,SAAA;KAAJ,KAAI6F;KAAa,OAAM;I,IACxB7F,EAiBI,KAAA;KAhBC,MAAM4D,EAAA;KACN,iBAAeA,EAAA;KACf,mBAAiB6B,EAAA,MAAS;KAC1B,oBAAkBA,EAAA,MAAS;KAC3B,qBAAmB7B,EAAA,YAAQ;KAC3B,oBAAkB3D,EAAA+F,EAAA,KAAU,KAAA;KAC7B,OAAM;KACL,cAAYpC,EAAA,YAAYlE,EAAAA,GAAE,YAAA;I,IAC3BQ,EAAAF,EAO4B,OAAA;KALvB,KAAK4D,EAAA;KACL,KAAKA,EAAA;KACN,UAAS;KACT,OAAM;KACL,QAAM0B;KACN,SAAOE;I,kBANA,CAAArF,GAAAiF,EAAA,UAAW,QAAA,C,YAWjBxB,EAAA,WAAWwB,EAAA,UAAW,aADhCvF,EAAA,GAAAC,EAIO,QAJP4C,GAIO,CADHtC,EAA8B2F,GAAA,EAAtB,MAAK,eAAc,CAAA,C,MAKhBX,EAAA,UAAW,WAD1BvF,EAAA,GAAAC,EAIO,QAJP6C,IAIO,CADHvC,EAAiC2F,GAAA,EAAzB,MAAK,kBAAiB,CAAA,C;IAGnBnC,EAAA,U,aAAnB/D,EAAA,GAAAC,EAiBa,cAjBb8C,IAiBa,CAfCgB,EAAA,YADV/D,EAAA,GAAAC,EAKC,QAAA;;KAHG,OAAM;KACL,OAAO8D,EAAA;IACJ,GAAAtD,EAAAsD,EAAA,QAAQ,GAAA,GAAAf,CAAA,K,WAEhB7C,EASO,QATP8C,GASO,CAPOc,EAAA,SADV/D,EAAA,GAAAC,EAMO,QAAA;;KAJH,OAAM;KACL,OAAO8D,EAAA;I,IACRxD,EAAuC2F,GAAA,EAA/B,MAAK,wBAAuB,CAAA,GAAGxF,EAAA,MACvCD,EAAGsD,EAAA,KAAK,GAAA,CAAA,C,aAEZ/D,EAAA,GAAAC,EAAuDU,GAAA,EAAA,KAAA,EAAA,GAAA,CAAnCD,EAAAD,EAAAqF,GAAA,MAAU,KAAI,KAAA,CAAA,GAAA,CAAA,C;IAIhC/B,EAAA,aAAS,CAAKA,EAAA,WADxB/D,EAAA,GAAAC,EAQS,UAAA;;KANL,MAAK;KACL,OAAM;KACL,OAAOJ,EAAAA,GAAE,eAAA;KACT,cAAYA,EAAAA,GAAE,eAAA;KACd,SAAK,AAAAwG,EAAA,OAAAzF,GAAA,MAAUd,EAAAA,MAAK,QAAA,GAAA,CAAA,SAAA,CAAA;I,IACrBS,EAA+B2F,GAAA,EAAvB,MAAK,gBAAe,CAAA,C;G,UAKpClG,EAAA,GAAAC,EAqFM,OAAA;;IAnFF,OAAKC,EAAA,CAAC,wDAAsD;KACJ,kCAAA6D,EAAA;KAAuD,oCAAAA,EAAA;KAA+D,0CAAAA,EAAA;;;IAK9K5D,EAWO,QAAA;KAVH,OAAM;KACL,OAAKU,EAAA,EAAA,iBAAqB2D,EAAA,MAAS,OAAM,CAAA;I,IAEhCT,EAAA,WADV/D,EAAA,GAAAc,EAG4CoF,GAAA;;KADxC,MAAK;KACL,OAAM;I,OACVlG,EAAA,GAAAc,EAG4CoF,GAAA;;KADvC,MAAM1B,EAAA,MAAS;KAChB,OAAM;;IAEdrE,EAiBO,QAjBPiD,GAiBO,CAfOW,EAAA,YADV/D,EAAA,GAAAC,EAKC,QAAA;;KAHG,OAAM;KACL,OAAO8D,EAAA;IACJ,GAAAtD,EAAAsD,EAAA,QAAQ,GAAA,GAAAV,CAAA,K,WAEhBlD,EASO,QATPmD,GASO,CAPOS,EAAA,SADV/D,EAAA,GAAAC,EAMO,QAAA;;KAJH,OAAM;KACL,OAAO8D,EAAA;I,IACRxD,EAAuC2F,GAAA,EAA/B,MAAK,wBAAuB,CAAA,GAAGxF,EAAA,MACvCD,EAAGsD,EAAA,KAAK,GAAA,CAAA,C,aAEZ/D,EAAA,GAAAC,EAAqDU,GAAA,EAAA,KAAA,EAAA,GAAA,CAAjCD,EAAAD,EAAAsF,GAAA,MAAQ,KAAI,KAAA,CAAA,GAAA,CAAA,C;IAM7B,CAAAhC,EAAA,WAAO,CAAKA,EAAA,SAAK,CAAKA,EAAA,WADjC/D,EAAA,GAAAC,EAkCO,QAAA;;KAhCH,OAAKC,EAAA,CAAC,oCAAkC,EAC2B,yCAAA6D,EAAA,aAAaA,EAAA,U;;KAItEA,EAAA,aADV/D,EAAA,GAAAC,EAQS,UAAA;;MANL,MAAK;MACL,OAAM;MACL,OAAOJ,EAAAA,GAAE,yBAAA;MACT,cAAU,GAAKA,EAAAA,GAAE,yBAAA,IAA8BkE,EAAA,WAAQ,MAASA,EAAA,aAAQ;MACxE,SAAK,AAAAsC,EAAA,QAAE,GAAAC,MAAAvC,EAAA,aAAAA,EAAA,UAAA,GAAAuC,CAAA;K,IACR/F,EAAuC2F,GAAA,EAA/B,MAAK,wBAAuB,CAAA,C;KAG9BnC,EAAA,aADV/D,EAAA,GAAAC,EAQS,UAAA;;MANL,MAAK;MACL,OAAM;MACL,OAAOJ,EAAAA,GAAE,sBAAA;MACT,cAAU,GAAKA,EAAAA,GAAE,sBAAA,IAA2BkE,EAAA,WAAQ,MAASA,EAAA,aAAQ;MACrE,SAAK,AAAAsC,EAAA,QAAE,GAAAC,MAAAvC,EAAA,aAAAA,EAAA,UAAA,GAAAuC,CAAA;K,IACR/F,EAA6B2F,GAAA,EAArB,MAAK,cAAa,CAAA,C;KAE9B/F,EASI,KAAA;MARC,MAAM4D,EAAA;MACP,QAAO;MACP,KAAI;MACJ,OAAM;MACL,OAAOlE,EAAAA,GAAE,iBAAA;MACT,cAAU,GAAKA,EAAAA,GAAE,iBAAA,IAAsBkE,EAAA,WAAQ,MAASA,EAAA,aAAQ;MAChE,SAAOC;K,IACRzD,EAAoC2F,GAAA,EAA5B,MAAK,qBAAoB,CAAA,C;;IAI/BnC,EAAA,aAAS,CAAKA,EAAA,WADxB/D,EAAA,GAAAC,EASS,UAAA;;KAPL,MAAK;KACL,OAAKC,EAAA,CAAC,mCAAiC,EAAA,2CAAA,CACe6D,EAAA,QAAO,CAAA,CAAA;KAC5D,OAAOlE,EAAAA,GAAE,eAAA;KACT,cAAYA,EAAAA,GAAE,eAAA;KACd,SAAK,AAAAwG,EAAA,QAAA,MAAEvG,EAAAA,MAAK,QAAA;I,IACbS,EAA+B2F,GAAA,EAAvB,MAAK,gBAAe,CAAA,C"}
|